Skip to content

Commit

Permalink
test(nestjs-tools-file-storage): increase timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Aug 2, 2024
1 parent a63a2ba commit a3ac6b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/file-storage/test/file-storage-google.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe(description, () => {
const newFileExists = await fileStorage.fileExists({ filePath: newFileName });
expect(newFileExists).toBe(true);
await fileStorage.deleteFile({ filePath: newFileName });
});
}, 7000);

it('deleteFile deletes a file', async () => {
const { filePath } = await createDummyFile(fileStorage);
Expand All @@ -85,7 +85,7 @@ describe(description, () => {
const upload = await fileStorage.uploadStream({ filePath });
const entry = Readable.from(content);
const ac = new AbortController();
const t = setTimeout(() => ac.abort(), 2000);
const t = setTimeout(() => ac.abort(), 2500);
const listener = once(upload, 'done', { signal: ac.signal }).finally(() => clearTimeout(t));
await pipeline(entry, upload);
await listener;
Expand Down Expand Up @@ -143,13 +143,13 @@ describe(description, () => {
console.warn('GC storage readDir is not completely implemented yet. Skipping test.');
// const expected = [parts.shift(), filePath];
// expect(result.every((item) => expected.includes(item))).toBe(true);
});
}, 7000);

it('deleteDir deletes a directory', async () => {
const dirPath = '';
//
await fileStorage.deleteDir({ dirPath });
await delay(100);
await delay(1000);
//
expect(await fileStorage.readDir({ dirPath })).toEqual([]);
});
Expand Down
8 changes: 4 additions & 4 deletions packages/file-storage/test/file-storage-s3.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe(description, () => {
const newFileExists = await fileStorage.fileExists({ filePath: newFileName });
expect(newFileExists).toBe(true);
await fileStorage.deleteFile({ filePath: newFileName });
});
}, 7000);

it('deleteFile deletes a file', async () => {
const { filePath } = await createDummyFile(fileStorage);
Expand All @@ -84,7 +84,7 @@ describe(description, () => {
const upload = await fileStorage.uploadStream({ filePath });
const entry = Readable.from(content);
const ac = new AbortController();
const t = setTimeout(() => ac.abort(), 2000);
const t = setTimeout(() => ac.abort(), 2500);
const listener = once(upload, 'done', { signal: ac.signal }).finally(() => clearTimeout(t));
await pipeline(entry, upload);
await listener;
Expand Down Expand Up @@ -143,13 +143,13 @@ describe(description, () => {
const parts = nestedFilePath.split('/');
const expected = [parts.shift(), filePath];
expect(result.every((item) => expected.includes(item))).toBe(true);
});
}, 7000);

it('deleteDir deletes a directory', async () => {
const dirPath = '';
//
await fileStorage.deleteDir({ dirPath });
await delay(100);
await delay(1000);

//
expect(await fileStorage.readDir({ dirPath })).toEqual([]);
Expand Down

0 comments on commit a3ac6b4

Please sign in to comment.