2018-03-31 03:30:30 +08:00
|
|
|
import {expect} from 'chai';
|
2019-12-10 17:44:35 +08:00
|
|
|
import {DiskMangerWorker} from '../../../../../src/backend/model/threading/DiskMangerWorker';
|
2018-03-31 03:30:30 +08:00
|
|
|
import * as path from 'path';
|
2019-12-10 17:44:35 +08:00
|
|
|
import {Config} from '../../../../../src/common/config/private/Config';
|
|
|
|
import {ProjectPath} from '../../../../../src/backend/ProjectPath';
|
|
|
|
import {Utils} from '../../../../../src/common/Utils';
|
2017-07-16 03:04:41 +08:00
|
|
|
|
|
|
|
describe('DiskMangerWorker', () => {
|
|
|
|
|
2017-07-16 20:03:16 +08:00
|
|
|
it('should parse metadata', async () => {
|
2020-01-08 05:28:59 +08:00
|
|
|
Config.Server.Media.folder = path.join(__dirname, '/../../../assets');
|
|
|
|
ProjectPath.ImageFolder = path.join(__dirname, '/../../../assets');
|
2018-03-31 03:30:30 +08:00
|
|
|
const dir = await DiskMangerWorker.scanDirectory('/');
|
2020-12-28 00:36:29 +08:00
|
|
|
// should match the number of media (photo/video) files in the assets folder
|
|
|
|
expect(dir.media.length).to.be.equals(7);
|
2020-01-08 05:28:59 +08:00
|
|
|
const expected = require(path.join(__dirname, '/../../../assets/test image öüóőúéáű-.,.json'));
|
2020-12-28 00:54:05 +08:00
|
|
|
expect(Utils.clone(dir.media[3].name)).to.be.deep.equal('test image öüóőúéáű-.,.jpg');
|
|
|
|
expect(Utils.clone(dir.media[3].metadata)).to.be.deep.equal(expected);
|
2017-07-16 03:04:41 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|