|
|
|
@ -102,61 +102,61 @@ describe('MetadataLoader', () => {
|
|
|
|
|
});
|
|
|
|
|
it('should load sidecar file with file extension for video', async () => {
|
|
|
|
|
const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4.json'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.json'));
|
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should load sidecar file without file extension for video', async () => {
|
|
|
|
|
const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec_v2.mp4'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4.json'));//sidecar "bunny_1sec_v2.xmp" is identical to "bunny_1sec.mp4.xmp" so we expect the same result
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.json'));//sidecar "bunny_1sec_v2.xmp" is identical to "bunny_1sec.mp4.xmp" so we expect the same result
|
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should retrieve both keywords from sidecar file for video', async () => {
|
|
|
|
|
const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4.json'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.json'));
|
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should retrieve one keyword from sidecar file for video', async () => {
|
|
|
|
|
const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec_v3.mp4'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec_v3.mp4.json'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec_v3.json'));
|
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should load sidecar file with file extension for photo', async () => {
|
|
|
|
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg.json'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata.json'));
|
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should load sidecar file without file extension for photo', async () => {
|
|
|
|
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v2.jpg'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v2.jpg.json'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v2.json'));
|
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should retrieve both keywords from sidecar file for photo', async () => {
|
|
|
|
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg.json'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata.json'));
|
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should retrieve one keyword from sidecar file for photo', async () => {
|
|
|
|
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v3.jpg'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v3.jpg.json'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v3.json'));
|
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should read keywords from photo without sidecar file', async () => {
|
|
|
|
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/metadata.jpg'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/metadata.jpg.json'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/metadata.json'));
|
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should merge keywords from photo with keywords from sidecar', async () => {
|
|
|
|
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/metadata_v2.jpg'));
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/metadata_v2.jpg.json')); //"metadata_v2.jpg" is identical to "metadata.jpg" and "metadata_v2.xmp" contains 2 different keywords
|
|
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/sidecar/metadata_v2.json')); //"metadata_v2.jpg" is identical to "metadata.jpg" and "metadata_v2.xmp" contains 2 different keywords
|
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|