1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00
pigallery2/test/backend/unit/model/threading/DiskMangerWorker.spec.ts

21 lines
967 B
TypeScript
Raw Normal View History

2018-03-30 15:30:30 -04:00
import {expect} from 'chai';
2019-12-10 10:44:35 +01:00
import {DiskMangerWorker} from '../../../../../src/backend/model/threading/DiskMangerWorker';
2018-03-30 15:30:30 -04:00
import * as path from 'path';
2019-12-10 10:44:35 +01:00
import {Config} from '../../../../../src/common/config/private/Config';
import {ProjectPath} from '../../../../../src/backend/ProjectPath';
import {Utils} from '../../../../../src/common/Utils';
2017-07-15 21:04:41 +02:00
describe('DiskMangerWorker', () => {
2017-07-16 14:03:16 +02:00
it('should parse metadata', async () => {
2018-03-30 15:30:30 -04:00
Config.Server.imagesFolder = path.join(__dirname, '/../../assets');
ProjectPath.ImageFolder = path.join(__dirname, '/../../assets');
const dir = await DiskMangerWorker.scanDirectory('/');
2019-02-15 16:19:30 -05:00
expect(dir.media.length).to.be.equals(4);
2019-01-13 17:38:39 +01:00
const expected = require(path.join(__dirname, '/../../assets/test image öüóőúéáű-.,.json'));
2019-01-26 18:03:40 -05: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-15 21:04:41 +02:00
});
});