1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

fixing gallery test

This commit is contained in:
Patrik J. Braun 2018-12-02 12:30:35 +01:00
parent c5d16d6ef8
commit 66d793fe05

View File

@ -2,7 +2,7 @@ import {expect} from 'chai';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import {Config} from '../../../../../common/config/private/Config'; import {Config} from '../../../../../common/config/private/Config';
import {DatabaseType, ReIndexingSensitivity} from '../../../../../common/config/private/IPrivateConfig'; import {DatabaseType} from '../../../../../common/config/private/IPrivateConfig';
import {SQLConnection} from '../../../../../backend/model/sql/SQLConnection'; import {SQLConnection} from '../../../../../backend/model/sql/SQLConnection';
import {GalleryManager} from '../../../../../backend/model/sql/GalleryManager'; import {GalleryManager} from '../../../../../backend/model/sql/GalleryManager';
import {DirectoryDTO} from '../../../../../common/entities/DirectoryDTO'; import {DirectoryDTO} from '../../../../../common/entities/DirectoryDTO';
@ -74,9 +74,13 @@ describe('GalleryManager', () => {
delete media.id; delete media.id;
}); });
if (dir.metaFile) { if (dir.metaFile) {
dir.metaFile.forEach((file: FileDTO) => { if (dir.metaFile.length === 0) {
delete file.id; delete dir.metaFile;
}); } else {
dir.metaFile.forEach((file: FileDTO) => {
delete file.id;
});
}
} }
if (dir.directories) { if (dir.directories) {
dir.directories.forEach((directory: DirectoryDTO) => { dir.directories.forEach((directory: DirectoryDTO) => {
@ -161,6 +165,7 @@ describe('GalleryManager', () => {
// delete subDir.directories; // delete subDir.directories;
DirectoryDTO.removeReferences(selected); DirectoryDTO.removeReferences(selected);
delete subDir.parent; delete subDir.parent;
delete subDir.metaFile;
removeIds(selected); removeIds(selected);
// selected.directories[0].parent = selected; // selected.directories[0].parent = selected;
expect(Utils.clone(selected)).to.deep.equal(Utils.clone(subDir)); expect(Utils.clone(selected)).to.deep.equal(Utils.clone(subDir));