diff --git a/test/calendar.test.js b/test/calendar.test.js index 89ec26d..770c076 100644 --- a/test/calendar.test.js +++ b/test/calendar.test.js @@ -120,6 +120,34 @@ describe('Calendar Merging API', () => { expect(actualOutput).toBe(expectedOutput); }); + test('EAT Event', async () => { + const input = loadCalendarFile('eat_time_zone_event.ics'); + const response = await request(server) + .post('/merge') + .send({ + linkGroupName: 'EAT Event', + calendars: [ + { + url: input, + prefix: 'EAT Event', + override: false, + }, + ], + }); + + expect(response.status).toBe(200); + expect(response.body.url).toMatch(/calendar\/EAT_Event/); + + // Check if the file was created in the test directory + const filePath = path.join(CALENDARS_DIR, 'EAT_Event.ics'); + expect(fs.existsSync(filePath)).toBe(true); + + // Load expected output and compare + const expectedOutput = fs.readFileSync(input, 'utf8'); + const actualOutput = fs.readFileSync(filePath, 'utf8'); + expect(actualOutput).toBe(expectedOutput); + }); + // test('Merge calendar without prefix', async () => { // const response = await request(server) // .post('/merge') diff --git a/test/test_calendars/eat_time_zone_event.ics b/test/test_calendars/eat_time_zone_event.ics index 379be4f..efe9a67 100644 --- a/test/test_calendars/eat_time_zone_event.ics +++ b/test/test_calendars/eat_time_zone_event.ics @@ -1,15 +1,11 @@ BEGIN:VCALENDAR +NAME:EAT Event VERSION:2.0 -PRODID:-//Example Corp//NONSGML Event//EN BEGIN:VEVENT UID:20231108T090000+0300-001@example.com DTSTAMP:20231108T090000+0300 DTSTART:20231108T090000+0300 DTEND:20231108T100000+0300 SUMMARY:EAT Event -DESCRIPTION:This event is scheduled in East Africa Time (UTC+3). -LOCATION:Virtual -STATUS:CONFIRMED -SEQUENCE:0 END:VEVENT -END:VCALENDAR +END:VCALENDAR \ No newline at end of file