From f2888808ec665d035ffd2dc3ca29904b2f2e4abb Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Tue, 29 Oct 2024 21:45:09 +0300 Subject: [PATCH] set up test for calendars with a prefix --- calendar.test.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/calendar.test.js b/calendar.test.js index 808ddf5..e67e57f 100644 --- a/calendar.test.js +++ b/calendar.test.js @@ -59,5 +59,26 @@ describe('Calendar Merging API', () => { const filePath = path.join(MERGED_CALENDARS_DIR, 'Time_Based_Calendar.ics'); expect(fs.existsSync(filePath)).toBe(true); }); + test('Merge calendar without prefix', async () => { + const response = await request(app) + .post('/merge') + .send({ + linkGroupName: 'No Prefix Calendar', + calendars: [ + { + url: 'https://www.calendarlabs.com/ical-calendar/ics/65/San_Francisco_Public_Holidays.ics', + prefix: '', + override: false, + }, + ], + }); + + expect(response.status).toBe(200); + expect(response.body.url).toMatch(/calendar\/No_Prefix_Calendar/); + + // Check if the file was created + const filePath = path.join(MERGED_CALENDARS_DIR, 'No_Prefix_Calendar.ics'); + expect(fs.existsSync(filePath)).toBe(true); + }); }); \ No newline at end of file