diff --git a/tests/local.test.js b/tests/local.test.js index 6532147..cf1ccdb 100644 --- a/tests/local.test.js +++ b/tests/local.test.js @@ -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,