Skip to content

Commit

Permalink
remove uploaded files afeter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Neo-Ryo committed May 27, 2024
1 parent e2e9f2f commit f825aeb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions server/__tests__/fileUpload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ beforeAll(() => {
});
beforeEach(() => {});
afterAll(() => {
const pathToFiles = 'server/fileUpload/images/1/';
fs.readdir(pathToFiles, (err, files) => {
if (err) {
console.error(err);
}
if (files) {
for (const file of files) {
fs.unlink(path.join(pathToFiles, file), (err) => {
if (err) {
console.error(err);
}
});
}
}
fs.rmdir(pathToFiles, (err) => {
if (err) {
console.error(err);
}
});
});

return appDataSource.destroy();
});

Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit f825aeb

Please sign in to comment.