1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/test/backend/unit/model/threading/DiskManagerWorker.spec.ts
GenericGuy f04ed67205 feat: container header meta data parsing
Adds parsing of container header data, which provides correct dates
for Matroska files and also fixes the issue that the bitrate shown
in the UI reflects only the video bitrate (not video + audio bitrate).
2023-09-03 15:35:19 +02:00

34 lines
1.5 KiB
TypeScript

import {expect} from 'chai';
import {DiskMangerWorker} from '../../../../../src/backend/model/threading/DiskMangerWorker';
import * as path from 'path';
import {Config} from '../../../../../src/common/config/private/Config';
import {ProjectPath} from '../../../../../src/backend/ProjectPath';
import {Utils} from '../../../../../src/common/Utils';
import {DatabaseType} from '../../../../../src/common/config/private/PrivateConfig';
declare const before: any;
describe('DiskMangerWorker', () => {
// loading default settings (this might have been changed by other tests)
before(() => {
Config.loadSync();
Config.Database.type = DatabaseType.sqlite;
Config.Faces.enabled = true;
Config.Faces.keywordsToPersons = true;
});
it('should parse metadata', async () => {
Config.Media.folder = path.join(__dirname, '/../../../assets');
ProjectPath.ImageFolder = path.join(__dirname, '/../../../assets');
const dir = await DiskMangerWorker.scanDirectory('/');
// should match the number of media (photo/video) files in the assets folder
expect(dir.media.length).to.be.equals(10);
const expected = require(path.join(__dirname, '/../../../assets/test image öüóőúéáű-.,.json'));
const i = dir.media.findIndex(m => m.name === 'test image öüóőúéáű-.,.jpg');
expect(Utils.clone(dir.media[i].name)).to.be.deep.equal('test image öüóőúéáű-.,.jpg');
expect(Utils.clone(dir.media[i].metadata)).to.be.deep.equal(expected);
});
});