test:update test forhandling timezones

This commit is contained in:
Ryan Mwangi 2024-11-13 15:17:17 +03:00
parent 2e9de0749d
commit cbdfdf6c97
2 changed files with 30 additions and 6 deletions

View File

@ -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')

View File

@ -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