test(calendar.test.js):Ensure the test merged calendars directory exists

This commit is contained in:
Ryan Mwangi 2024-11-04 21:21:58 +03:00
parent b7a419f9cb
commit 0fc02c579d
1 changed files with 5 additions and 3 deletions

View File

@ -11,11 +11,13 @@ let server;
describe('Calendar Merging API', () => { describe('Calendar Merging API', () => {
beforeAll(async () => { beforeAll(async () => {
// Set environment variable for the test directory
process.env.TEST_MERGED_CALENDARS_DIR = TEST_MERGED_CALENDARS_DIR;
// Start the server // Start the server
server = app.listen(0); server = app.listen(0);
// Ensure the merged calendars directory exists // Ensure the test merged calendars directory exists
if (!fs.existsSync(MERGED_CALENDARS_DIR)) { if (!fs.existsSync(TEST_MERGED_CALENDARS_DIR)) {
fs.mkdirSync(MERGED_CALENDARS_DIR); fs.mkdirSync(TEST_MERGED_CALENDARS_DIR, { recursive: true });
} }
}); });