Compare commits

..

No commits in common. "17c3fb7b8505960fbba0163167c3bb908d60764b" and "f67594e072e0d0cf6cb2fad638dc25ef96b246a4" have entirely different histories.

1 changed files with 12 additions and 10 deletions

View File

@ -12,13 +12,15 @@ describe('Calendar Merging API', () => {
beforeAll(async () => { beforeAll(async () => {
// Start the server // Start the server
server = app.listen(0); server = app.listen(0);
console.log(`Server started on port 3000`);
// Ensure the merged calendars directory exists // Ensure the merged calendars directory exists
if (!fs.existsSync(MERGED_CALENDARS_DIR)) { if (!fs.existsSync(MERGED_CALENDARS_DIR)) {
fs.mkdirSync(MERGED_CALENDARS_DIR); fs.mkdirSync(MERGED_CALENDARS_DIR);
} }
}); });
afterAll(async () => { afterAll( async () => {
// Clean up the merged calendars directory after tests // Clean up the merged calendars directory after tests
if (fs.existsSync(MERGED_CALENDARS_DIR)) { if (fs.existsSync(MERGED_CALENDARS_DIR)) {
fs.rmSync(MERGED_CALENDARS_DIR, { recursive: true, force: true }); fs.rmSync(MERGED_CALENDARS_DIR, { recursive: true, force: true });
@ -38,13 +40,13 @@ describe('Calendar Merging API', () => {
linkGroupName: 'Date Based Calendar', linkGroupName: 'Date Based Calendar',
calendars: [ calendars: [
{ {
url: loadCalendarFile('ferien_bayern_2023.ics'), url: loadCalendarFile(`ferien_bayern_2023.ics`),
prefix: 'Ferien_Bayern_2023', prefix: 'Ferien_Bayern_2023',
override: false, override: false,
}, },
{ {
url: loadCalendarFile('US_Holidays.ics'), url: loadCalendarFile(`US_Holidays.ics`),
prefix: 'US_holidays', prefix: "US_holidays",
override: false, override: false,
}, },
], ],
@ -59,17 +61,17 @@ describe('Calendar Merging API', () => {
test('Merge time-based calendar', async () => { test('Merge time-based calendar', async () => {
const response = await request(server) const response = await request(server)
.post('/merge') .post('/merge')
.send({ .send({
linkGroupName: 'Time Based Calendar', linkGroupName: 'Time Based Calendar',
calendars: [ calendars: [
{ {
url: loadCalendarFile('other_work.ics'), url: loadCalendarFile(`other_work.ics`),
prefix: 'other_work', prefix: 'other_work',
override: false, override: false,
}, },
{ {
url: loadCalendarFile('work.ics'), url: loadCalendarFile(`work.ics`),
prefix: 'work', prefix: 'work',
override: false, override: false,
}, },
@ -91,7 +93,7 @@ describe('Calendar Merging API', () => {
linkGroupName: 'No Prefix Calendar', linkGroupName: 'No Prefix Calendar',
calendars: [ calendars: [
{ {
url: loadCalendarFile('San_Francisco_Public_Holidays.ics'), url: loadCalendarFile(`San_Francisco_Public_Holidays.ics`),
prefix: '', prefix: '',
override: false, override: false,
}, },
@ -113,7 +115,7 @@ describe('Calendar Merging API', () => {
linkGroupName: 'Override Calendar', linkGroupName: 'Override Calendar',
calendars: [ calendars: [
{ {
url: loadCalendarFile('San_Francisco_Public_Holidays.ics'), url: loadCalendarFile(`San_Francisco_Public_Holidays.ics`),
prefix: 'Override Event', prefix: 'Override Event',
override: true, override: true,
}, },
@ -128,4 +130,4 @@ describe('Calendar Merging API', () => {
expect(fs.existsSync(filePath)).toBe(true); expect(fs.existsSync(filePath)).toBe(true);
}); });
}); });