2018-12-21 06:02:49 +08:00
|
|
|
import {expect} from 'chai';
|
|
|
|
import {MetadataLoader} from '../../../../../backend/model/threading/MetadataLoader';
|
|
|
|
import {Utils} from '../../../../../common/Utils';
|
|
|
|
import * as path from 'path';
|
|
|
|
|
|
|
|
describe('MetadataLoader', () => {
|
|
|
|
|
|
|
|
it('should load png', async () => {
|
|
|
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../assets/test_png.png'));
|
2018-12-22 08:14:13 +08:00
|
|
|
delete data.creationDate; // creation time for png not supported
|
2018-12-21 06:02:49 +08:00
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(Utils.clone({
|
2018-12-22 07:44:28 +08:00
|
|
|
fileSize: 2155,
|
2018-12-21 06:02:49 +08:00
|
|
|
orientation: 1,
|
|
|
|
size: {
|
|
|
|
height: 26,
|
|
|
|
width: 26
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should load jpg', async () => {
|
|
|
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../assets/test image öüóőúéáű-.,.jpg'));
|
2019-01-14 00:38:39 +08:00
|
|
|
const expected = require(path.join(__dirname, '/../../assets/test image öüóőúéáű-.,.json'));
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
2018-12-21 06:02:49 +08:00
|
|
|
});
|
|
|
|
|
2019-01-19 17:07:06 +08:00
|
|
|
|
|
|
|
it('should load jpg 2', async () => {
|
|
|
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../assets/old_photo.jpg'));
|
|
|
|
const expected = require(path.join(__dirname, '/../../assets/old_photo.json'));
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
});
|
|
|
|
|
2019-02-16 05:19:30 +08:00
|
|
|
|
|
|
|
it('should load mp4', async () => {
|
|
|
|
const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../assets/video.mp4'));
|
|
|
|
const expected = require(path.join(__dirname, '/../../assets/video.json'));
|
|
|
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2018-12-21 06:02:49 +08:00
|
|
|
});
|