Comparing version 1.1.5 to 1.1.6
@@ -90,2 +90,10 @@ const fs = require('fs'); | ||
function result(source, list) { | ||
if (!list.length) { | ||
return { | ||
error: 'No preview detected', | ||
source | ||
}; | ||
} | ||
const item = list.shift(); | ||
@@ -191,3 +199,3 @@ | ||
items.push(result(source, [main, meta.error, create.error])); | ||
items.push(result(source, [main, meta.error, create.error].filter(item => item))); | ||
@@ -194,0 +202,0 @@ if (list.length) { |
{ | ||
"name": "extractd", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Extract previews from DSLR and mirrorless cameras' RAW files", | ||
@@ -5,0 +5,0 @@ "main": "extractd.js", |
@@ -267,4 +267,8 @@ # extractd | ||
## Test samples | ||
All test samples are based on original raw files sourced from [photography blog](https://www.photographyblog.com/reviews) and [hasselblad](https://www.hasselblad.com/learn/sample-images/) sites. | ||
## License | ||
The MIT License (MIT). Please see [license](https://github.com/przemyslawpluta/extractd/blob/master/LICENSE) file for more information. |
@@ -24,2 +24,3 @@ const fs = require('fs'); | ||
`${samples}/fujifilm_x_t3_01.raf`, | ||
`${samples}/leica_cl_01.dng`, | ||
`${samples}/dummyFile.nef` | ||
@@ -44,3 +45,3 @@ ]; | ||
expect(done).to.have.lengthOf(7); | ||
expect(done).to.have.lengthOf(8); | ||
@@ -164,4 +165,21 @@ }); | ||
it('leica preview item in the array should contain objects with preview and source files', async () => { | ||
const item = done.filter(item => item.preview).filter(item => item.preview.includes('leica')).shift(); | ||
expect(item).to.have.own.property('preview'); | ||
expect(item).to.have.own.property('source'); | ||
expect(path.dirname(item.source)).to.be.deep.equal(path.dirname(item.preview)); | ||
expect(path.basename(item.source, path.extname(item.source))).to.be.deep.equal(path.basename(item.preview, '.jpg')); | ||
expect(path.extname(item.preview)).to.deep.equal('.jpg'); | ||
await del(item.preview); | ||
}); | ||
}); | ||
}); |
@@ -24,2 +24,3 @@ const fs = require('fs'); | ||
`${samples}/fujifilm_x_t3_01.raf`, | ||
`${samples}/leica_cl_01.dng`, | ||
`${samples}/dummyFile.nef` | ||
@@ -46,3 +47,3 @@ ]; | ||
expect(done).to.have.lengthOf(6); | ||
expect(done).to.have.lengthOf(7); | ||
@@ -133,4 +134,16 @@ }); | ||
it('leica preview should be returned in array', async () => { | ||
const item = done.filter(item => item.includes('leica')).shift(); | ||
expect(item).to.be.a('string'); | ||
expect(path.extname(item)).to.deep.equal('.jpg'); | ||
await del(item); | ||
}); | ||
}); | ||
}); |
@@ -40,2 +40,28 @@ const fs = require('fs'); | ||
context('with existing file but non jpg preview format', () => { | ||
it('should return file not found error', async () => { | ||
const source = `${samples}/hasselblad_x1d_01.fff`; | ||
const done = await extractd.generate(source); | ||
expect(done).to.be.an('object'); | ||
expect(done).to.deep.equal({ | ||
error: 'No preview detected', | ||
source: `${source}` | ||
}); | ||
}); | ||
it('should indicate no persistent status', () => { | ||
const status = extractd.status(); | ||
expect(status.persistent).to.be.false; | ||
}); | ||
}); | ||
context('with existing file and set destination', () => { | ||
@@ -42,0 +68,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31407
533
274