mirror of
https://github.com/filecoffee/filehost.git
synced 2024-11-13 19:49:56 +01:00
adding cleanup to tests
This commit is contained in:
parent
4cbc4c2d31
commit
a0ae2274f9
1 changed files with 12 additions and 0 deletions
|
@ -15,6 +15,18 @@ if (!fs.existsSync(uploadPath)) {
|
|||
fs.mkdirSync(uploadPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure we clean up the uploads directory after each test
|
||||
*/
|
||||
afterEach(() => {
|
||||
const files = fs.readdirSync(uploadPath);
|
||||
files.forEach((file) => {
|
||||
if (file !== "test.txt" && file !== ".gitkeep") {
|
||||
fs.unlinkSync(path.join(uploadPath, file));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const storageEngine = initializeLocalStorage(
|
||||
multerOptions,
|
||||
fileNameLength,
|
||||
|
|
Loading…
Reference in a new issue