test: preserve date-based calendar
This commit is contained in:
parent
441f4d2fb3
commit
4032e2c49d
|
@ -34,6 +34,31 @@ describe('Calendar Merging API', () => {
|
||||||
return fs.readFileSync(path.join(EXPECTED_OUTPUTS_DIR, filename), 'utf8');
|
return fs.readFileSync(path.join(EXPECTED_OUTPUTS_DIR, filename), 'utf8');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
test('Preserve date-based calendar', async () => {
|
||||||
|
const input = loadCalendarFile('US_Holidays.ics');
|
||||||
|
const response = await request(server)
|
||||||
|
.post('/merge')
|
||||||
|
.send({
|
||||||
|
linkGroupName: 'US Holidays',
|
||||||
|
calendars: [
|
||||||
|
{
|
||||||
|
url: input,
|
||||||
|
prefix: '',
|
||||||
|
override: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
expect(response.status).toBe(200);
|
||||||
|
// Check if the file was created in the test directory
|
||||||
|
const filePath = path.join(CALENDARS_DIR, 'US_Holidays.ics');
|
||||||
|
console.log('Checking if file exists at:', filePath);
|
||||||
|
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 date-based calendar', async () => {
|
test('Merge date-based calendar', async () => {
|
||||||
const response = await request(server)
|
const response = await request(server)
|
||||||
.post('/merge')
|
.post('/merge')
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
BEGIN:VCALENDAR
|
BEGIN:VCALENDAR
|
||||||
PRODID:-//Your Product ID//EN
|
|
||||||
VERSION:2.0
|
VERSION:2.0
|
||||||
NAME:Date Based Calendar
|
NAME:Date Based Calendar
|
||||||
BEGIN:VEVENT
|
BEGIN:VEVENT
|
||||||
|
@ -14,4 +13,4 @@ SUMMARY:US_holidays Christmas Day
|
||||||
DTSTART:20231225T000000
|
DTSTART:20231225T000000
|
||||||
DTEND:20231226T000000
|
DTEND:20231226T000000
|
||||||
END:VEVENT
|
END:VEVENT
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
BEGIN:VCALENDAR
|
BEGIN:VCALENDAR
|
||||||
|
NAME:US Holidays
|
||||||
VERSION:2.0
|
VERSION:2.0
|
||||||
PRODID:-//Example Corp//NONSGML Event//EN
|
|
||||||
BEGIN:VEVENT
|
BEGIN:VEVENT
|
||||||
UID:20231225T000000-001@example.com
|
UID:20231225T000000-001@example.com
|
||||||
DTSTAMP:20231225T000000Z
|
DTSTAMP:20231225T000000Z
|
||||||
DTSTART;VALUE=DATE:20231225
|
DTSTART;VALUE=DATE:20231225
|
||||||
DTEND;VALUE=DATE:20231226
|
DTEND;VALUE=DATE:20231226
|
||||||
SUMMARY:Christmas Day
|
SUMMARY:Christmas Day
|
||||||
DESCRIPTION:Public holiday for Christmas in The US.
|
|
||||||
LOCATION:San Francisco
|
|
||||||
STATUS:CONFIRMED
|
|
||||||
SEQUENCE:0
|
|
||||||
END:VEVENT
|
END:VEVENT
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
|
Loading…
Reference in New Issue