Skip to content

Commit 7e1c8c9

Browse files
committed
test(nestjs-tools-file-storage): add integration tests for moveFile
1 parent 62629d9 commit 7e1c8c9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/file-storage/test/file-storage.spec.ts

+14
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@ testMap.forEach((testSuite) => {
134134
await fileStorage.deleteFile({ filePath });
135135
});
136136

137+
it('moveFile moves a file to a new location and remove the previous one', async () => {
138+
const oldFileName = 'oldFileName.txt';
139+
const newFileName = 'newFileName.txt';
140+
await fileStorage.uploadFile({ filePath: oldFileName, content: 'this is a test' });
141+
//
142+
await fileStorage.moveFile({ filePath: oldFileName, newFilePath: newFileName });
143+
//
144+
const oldFileExists = await fileStorage.fileExists({ filePath: oldFileName });
145+
expect(oldFileExists).toBe(false);
146+
const newFileExists = await fileStorage.fileExists({ filePath: newFileName });
147+
expect(newFileExists).toBe(true);
148+
await fileStorage.deleteFile({ filePath: newFileName });
149+
});
150+
137151
it('deleteFile deletes a file', async () => {
138152
const filePath = randomUUID();
139153
await fileStorage.uploadFile({ filePath, content: 'this is a test' });

0 commit comments

Comments
 (0)