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