2023-10-23 17:52:21 +02:00
|
|
|
import { IStorageRepository, StorageCore } from '@app/domain';
|
|
|
|
|
|
|
|
export const newStorageRepositoryMock = (reset = true): jest.Mocked<IStorageRepository> => {
|
|
|
|
if (reset) {
|
|
|
|
StorageCore.reset();
|
|
|
|
}
|
2023-02-03 16:16:25 +01:00
|
|
|
|
|
|
|
return {
|
2023-06-30 18:24:28 +02:00
|
|
|
createZipStream: jest.fn(),
|
2023-02-03 16:16:25 +01:00
|
|
|
createReadStream: jest.fn(),
|
2023-09-27 20:44:51 +02:00
|
|
|
readFile: jest.fn(),
|
|
|
|
writeFile: jest.fn(),
|
2023-02-25 15:12:03 +01:00
|
|
|
unlink: jest.fn(),
|
2023-05-26 21:43:24 +02:00
|
|
|
unlinkDir: jest.fn().mockResolvedValue(true),
|
2023-02-25 15:12:03 +01:00
|
|
|
removeEmptyDirs: jest.fn(),
|
|
|
|
moveFile: jest.fn(),
|
|
|
|
checkFileExists: jest.fn(),
|
|
|
|
mkdirSync: jest.fn(),
|
2023-03-22 03:49:19 +01:00
|
|
|
checkDiskUsage: jest.fn(),
|
2023-08-02 03:56:10 +02:00
|
|
|
readdir: jest.fn(),
|
2023-09-20 13:16:33 +02:00
|
|
|
stat: jest.fn(),
|
|
|
|
crawl: jest.fn(),
|
2023-02-03 16:16:25 +01:00
|
|
|
};
|
|
|
|
};
|