test(calendar): clean up merged calendars directory after tests

This commit is contained in:
Ryan Mwangi 2024-11-27 13:24:14 +03:00
parent 18215a89f6
commit 869beeb3d4
1 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,12 @@ describe('Calendar Merging API', () => {
// Ensure the server is closed before cleanup // Ensure the server is closed before cleanup
await new Promise(resolve => server.close(resolve)); await new Promise(resolve => server.close(resolve));
// Clean up the merged calendars directory after tests
fs.rmdirSync(CALENDARS_DIR, { recursive: true });
if (fs.existsSync(CALENDARS_DIR)) {
fs.rmdirSync(CALENDARS_DIR, { recursive: true });
}
// Optional: Add a delay to ensure all handles are released // Optional: Add a delay to ensure all handles are released
await new Promise(resolve => setTimeout(resolve, 100)); await new Promise(resolve => setTimeout(resolve, 100));
}); });