2018-03-31 03:30:30 +08:00
|
|
|
import {expect} from 'chai';
|
|
|
|
import {DiskMangerWorker} from '../../../../../backend/model/threading/DiskMangerWorker';
|
|
|
|
import * as path from 'path';
|
|
|
|
import {Config} from '../../../../../common/config/private/Config';
|
|
|
|
import {ProjectPath} from '../../../../../backend/ProjectPath';
|
2019-01-14 00:38:39 +08:00
|
|
|
import {Utils} from '../../../../../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 () => {
|
2018-03-31 03:30:30 +08:00
|
|
|
Config.Server.imagesFolder = path.join(__dirname, '/../../assets');
|
|
|
|
ProjectPath.ImageFolder = path.join(__dirname, '/../../assets');
|
|
|
|
const dir = await DiskMangerWorker.scanDirectory('/');
|
2019-02-16 05:19:30 +08:00
|
|
|
expect(dir.media.length).to.be.equals(4);
|
2019-01-14 00:38:39 +08:00
|
|
|
const expected = require(path.join(__dirname, '/../../assets/test image öüóőúéáű-.,.json'));
|
2019-01-27 07:03:40 +08:00
|
|
|
expect(Utils.clone(dir.media[1].name)).to.be.deep.equal('test image öüóőúéáű-.,.jpg');
|
|
|
|
expect(Utils.clone(dir.media[1].metadata)).to.be.deep.equal(expected);
|
2017-07-16 03:04:41 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|