mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
Adding DB reset test
This commit is contained in:
parent
b7db019c70
commit
df42ebd9db
@ -77,6 +77,10 @@ export abstract class Job<T = void> implements IJob<T> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns with true if more steps are left or false if no more
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
protected abstract step(): Promise<boolean>;
|
protected abstract step(): Promise<boolean>;
|
||||||
|
|
||||||
protected abstract init(): Promise<void>;
|
protected abstract init(): Promise<void>;
|
||||||
|
@ -15,7 +15,7 @@ import {PersonManager} from '../../../../../src/backend/model/database/sql/Perso
|
|||||||
import {DBTestHelper} from '../../../DBTestHelper';
|
import {DBTestHelper} from '../../../DBTestHelper';
|
||||||
import {VersionManager} from '../../../../../src/backend/model/database/sql/VersionManager';
|
import {VersionManager} from '../../../../../src/backend/model/database/sql/VersionManager';
|
||||||
import {DiskMangerWorker} from '../../../../../src/backend/model/threading/DiskMangerWorker';
|
import {DiskMangerWorker} from '../../../../../src/backend/model/threading/DiskMangerWorker';
|
||||||
import {ReIndexingSensitivity, ServerConfig} from '../../../../../src/common/config/private/PrivateConfig';
|
import {ReIndexingSensitivity} from '../../../../../src/common/config/private/PrivateConfig';
|
||||||
|
|
||||||
const deepEqualInAnyOrder = require('deep-equal-in-any-order');
|
const deepEqualInAnyOrder = require('deep-equal-in-any-order');
|
||||||
const chai = require('chai');
|
const chai = require('chai');
|
||||||
@ -473,6 +473,32 @@ describe('IndexingManager', (sqlHelper: DBTestHelper) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('should reset DB', async () => {
|
||||||
|
const gm = new GalleryManagerTest();
|
||||||
|
const im = new IndexingManagerTest();
|
||||||
|
|
||||||
|
const parent = TestHelper.getRandomizedDirectoryEntry();
|
||||||
|
const p1 = TestHelper.getRandomizedPhotoEntry(parent, 'Photo1');
|
||||||
|
const p2 = TestHelper.getRandomizedPhotoEntry(parent, 'Photo2');
|
||||||
|
|
||||||
|
DirectoryDTOUtils.packDirectory(parent);
|
||||||
|
await im.saveToDB(Utils.clone(parent));
|
||||||
|
|
||||||
|
const conn = await SQLConnection.getConnection();
|
||||||
|
const selected = await gm.selectParentDir(conn, parent.name, parent.path);
|
||||||
|
await gm.fillParentDir(conn, selected);
|
||||||
|
|
||||||
|
DirectoryDTOUtils.packDirectory(selected);
|
||||||
|
removeIds(selected);
|
||||||
|
expect(Utils.clone(Utils.removeNullOrEmptyObj(selected)))
|
||||||
|
.to.deep.equal(Utils.clone(Utils.removeNullOrEmptyObj(parent)));
|
||||||
|
|
||||||
|
await im.resetDB();
|
||||||
|
const selectReset = await gm.selectParentDir(conn, parent.name, parent.path);
|
||||||
|
expect(selectReset).to.deep.equal(undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
(it('should save 1500 photos', async () => {
|
(it('should save 1500 photos', async () => {
|
||||||
const conn = await SQLConnection.getConnection();
|
const conn = await SQLConnection.getConnection();
|
||||||
const gm = new GalleryManagerTest();
|
const gm = new GalleryManagerTest();
|
||||||
|
Loading…
Reference in New Issue
Block a user