From 0fc02c579d692074b789b90efe30da90fd66d385 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Mon, 4 Nov 2024 21:21:58 +0300 Subject: [PATCH] test(calendar.test.js):Ensure the test merged calendars directory exists --- calendar.test.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/calendar.test.js b/calendar.test.js index 1e4b4dd..16e57f2 100644 --- a/calendar.test.js +++ b/calendar.test.js @@ -11,11 +11,13 @@ let server; describe('Calendar Merging API', () => { beforeAll(async () => { + // Set environment variable for the test directory + process.env.TEST_MERGED_CALENDARS_DIR = TEST_MERGED_CALENDARS_DIR; // Start the server server = app.listen(0); - // Ensure the merged calendars directory exists - if (!fs.existsSync(MERGED_CALENDARS_DIR)) { - fs.mkdirSync(MERGED_CALENDARS_DIR); + // Ensure the test merged calendars directory exists + if (!fs.existsSync(TEST_MERGED_CALENDARS_DIR)) { + fs.mkdirSync(TEST_MERGED_CALENDARS_DIR, { recursive: true }); } });