From cf10a6204993f3659e9958fcda999a2fbde56127 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Thu, 7 Nov 2024 14:11:09 +0300 Subject: [PATCH] refactor: streamline static file serving --- server.js | 12 +- tests/calendar/Date_Based_Calendar.ics | 336 ++++++++++++++++++++++++ tests/calendar/Date_Based_Calendar.json | 16 ++ tests/calendar/No_Prefix_Calendar.ics | 266 +++++++++++++++++++ tests/calendar/No_Prefix_Calendar.json | 11 + tests/calendar/Override_Calendar.ics | 266 +++++++++++++++++++ tests/calendar/Override_Calendar.json | 11 + tests/calendar/Time_Based_Calendar.ics | 46 ++++ tests/calendar/Time_Based_Calendar.json | 16 ++ 9 files changed, 971 insertions(+), 9 deletions(-) create mode 100644 tests/calendar/Date_Based_Calendar.ics create mode 100644 tests/calendar/Date_Based_Calendar.json create mode 100644 tests/calendar/No_Prefix_Calendar.ics create mode 100644 tests/calendar/No_Prefix_Calendar.json create mode 100644 tests/calendar/Override_Calendar.ics create mode 100644 tests/calendar/Override_Calendar.json create mode 100644 tests/calendar/Time_Based_Calendar.ics create mode 100644 tests/calendar/Time_Based_Calendar.json diff --git a/server.js b/server.js index db2a6c5..dbdfd68 100644 --- a/server.js +++ b/server.js @@ -8,21 +8,15 @@ import icalGenerator from 'ical-generator'; const app = express(); app.use(express.json()); -// Determine the merged calendars directory based on the environment const MERGED_CALENDARS_DIR = path.join(process.cwd(), 'calendar'); console.log(`Merged calendars directory: ${MERGED_CALENDARS_DIR} under ${process.cwd()}`); // Ensure the merged calendars directory exists fs.mkdirSync(MERGED_CALENDARS_DIR, { recursive: true }); -app.get('/script.js', (req, res) => { - res.setHeader('Content-Type', 'application/javascript'); - res.sendFile('script.js', { root: '.' }); -}); - -app.get('/', (req, res) => { - res.sendFile('index.html', { root: '.' }); -}); +// Serve static files +app.get('/script.js', (req, res) => res.sendFile('script.js', { root: '.' })); +app.get('/', (req, res) => res.sendFile('index.html', { root: '.' })); // Function to sanitize the linkGroupName for use as a filename function sanitizeFilename(filename) { diff --git a/tests/calendar/Date_Based_Calendar.ics b/tests/calendar/Date_Based_Calendar.ics new file mode 100644 index 0000000..206481c --- /dev/null +++ b/tests/calendar/Date_Based_Calendar.ics @@ -0,0 +1,336 @@ +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//sebbo.net//ical-generator//EN +NAME:Date Based Calendar +X-WR-CALNAME:Date Based Calendar +BEGIN:VEVENT +UID:ux86@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20230219 +DTEND;VALUE=DATE:20230224 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Ferien_Bayern_2023 Winterferien 2023 Bayern +END:VEVENT +BEGIN:VEVENT +UID:uqqc@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20230402 +DTEND;VALUE=DATE:20230415 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Ferien_Bayern_2023 Osterferien 2023 Bayern +END:VEVENT +BEGIN:VEVENT +UID:s5s6@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20230529 +DTEND;VALUE=DATE:20230609 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Ferien_Bayern_2023 Pfingstferien 2023 Bayern +END:VEVENT +BEGIN:VEVENT +UID:d1co@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20230730 +DTEND;VALUE=DATE:20230911 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Ferien_Bayern_2023 Sommerferien 2023 Bayern +END:VEVENT +BEGIN:VEVENT +UID:bfa2@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20231029 +DTEND;VALUE=DATE:20231103 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Ferien_Bayern_2023 Herbstferien 2023 Bayern +END:VEVENT +BEGIN:VEVENT +UID:422p@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20231121 +DTEND;VALUE=DATE:20231122 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Ferien_Bayern_2023 Herbstferien 2023 Bayern +END:VEVENT +BEGIN:VEVENT +UID:pn88@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20231222 +DTEND;VALUE=DATE:20240105 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Ferien_Bayern_2023 Weihnachtsferien 2023 Bayern +END:VEVENT +BEGIN:VEVENT +UID:kn7n@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20231231 +DTEND;VALUE=DATE:20231231 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays New Year's Day +END:VEVENT +BEGIN:VEVENT +UID:m3pg@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240114 +DTEND;VALUE=DATE:20240114 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays M L King Day +END:VEVENT +BEGIN:VEVENT +UID:39ny@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240218 +DTEND;VALUE=DATE:20240218 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Presidents' Day +END:VEVENT +BEGIN:VEVENT +UID:5ifw@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240328 +DTEND;VALUE=DATE:20240328 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Good Friday +END:VEVENT +BEGIN:VEVENT +UID:nb38@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240330 +DTEND;VALUE=DATE:20240330 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Easter Sunday +END:VEVENT +BEGIN:VEVENT +UID:lz4n@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240526 +DTEND;VALUE=DATE:20240526 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Memorial Day +END:VEVENT +BEGIN:VEVENT +UID:0h55@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240618 +DTEND;VALUE=DATE:20240618 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Juneteenth +END:VEVENT +BEGIN:VEVENT +UID:rw2w@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240703 +DTEND;VALUE=DATE:20240703 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Independence Day +END:VEVENT +BEGIN:VEVENT +UID:7c9g@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240901 +DTEND;VALUE=DATE:20240901 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Labor Day +END:VEVENT +BEGIN:VEVENT +UID:0nz9@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20241013 +DTEND;VALUE=DATE:20241013 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Columbus Day +END:VEVENT +BEGIN:VEVENT +UID:e9ol@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20241110 +DTEND;VALUE=DATE:20241110 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Veterans Day +END:VEVENT +BEGIN:VEVENT +UID:p38j@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20241127 +DTEND;VALUE=DATE:20241127 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Thanksgiving Day +END:VEVENT +BEGIN:VEVENT +UID:379a@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20241224 +DTEND;VALUE=DATE:20241224 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Christmas +END:VEVENT +BEGIN:VEVENT +UID:cpof@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20241231 +DTEND;VALUE=DATE:20241231 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays New Year's Day +END:VEVENT +BEGIN:VEVENT +UID:p0aq@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250119 +DTEND;VALUE=DATE:20250119 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays M L King Day +END:VEVENT +BEGIN:VEVENT +UID:kb3l@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250216 +DTEND;VALUE=DATE:20250216 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Presidents' Day +END:VEVENT +BEGIN:VEVENT +UID:htk4@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250417 +DTEND;VALUE=DATE:20250417 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Good Friday +END:VEVENT +BEGIN:VEVENT +UID:db0o@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250419 +DTEND;VALUE=DATE:20250419 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Easter Sunday +END:VEVENT +BEGIN:VEVENT +UID:v0s3@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250525 +DTEND;VALUE=DATE:20250525 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Memorial Day +END:VEVENT +BEGIN:VEVENT +UID:7hxd@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250618 +DTEND;VALUE=DATE:20250618 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Juneteenth +END:VEVENT +BEGIN:VEVENT +UID:1zlu@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250703 +DTEND;VALUE=DATE:20250703 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Independence Day +END:VEVENT +BEGIN:VEVENT +UID:ujrf@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250831 +DTEND;VALUE=DATE:20250831 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Labor Day +END:VEVENT +BEGIN:VEVENT +UID:0vwh@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20251012 +DTEND;VALUE=DATE:20251012 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Columbus Day +END:VEVENT +BEGIN:VEVENT +UID:5lwh@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20251110 +DTEND;VALUE=DATE:20251110 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Veterans Day +END:VEVENT +BEGIN:VEVENT +UID:iz9d@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20251126 +DTEND;VALUE=DATE:20251126 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Thanksgiving Day +END:VEVENT +BEGIN:VEVENT +UID:9siv@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20251224 +DTEND;VALUE=DATE:20251224 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:US_holidays Christmas +END:VEVENT +END:VCALENDAR \ No newline at end of file diff --git a/tests/calendar/Date_Based_Calendar.json b/tests/calendar/Date_Based_Calendar.json new file mode 100644 index 0000000..74abda2 --- /dev/null +++ b/tests/calendar/Date_Based_Calendar.json @@ -0,0 +1,16 @@ +{ + "id": "Date_Based_Calendar", + "linkGroupName": "Date Based Calendar", + "calendars": [ + { + "url": "C:\\Users\\user\\OneDrive\\Desktop\\Internship_tasks\\final calmerg\\tests\\test_calendars\\ferien_bayern_2023.ics", + "prefix": "Ferien_Bayern_2023", + "override": false + }, + { + "url": "C:\\Users\\user\\OneDrive\\Desktop\\Internship_tasks\\final calmerg\\tests\\test_calendars\\US_Holidays.ics", + "prefix": "US_holidays", + "override": false + } + ] +} \ No newline at end of file diff --git a/tests/calendar/No_Prefix_Calendar.ics b/tests/calendar/No_Prefix_Calendar.ics new file mode 100644 index 0000000..58a7d96 --- /dev/null +++ b/tests/calendar/No_Prefix_Calendar.ics @@ -0,0 +1,266 @@ +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//sebbo.net//ical-generator//EN +NAME:No Prefix Calendar +X-WR-CALNAME:No Prefix Calendar +BEGIN:VEVENT +UID:3xkm@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20231231 +DTEND;VALUE=DATE:20231231 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: New Year's Day +END:VEVENT +BEGIN:VEVENT +UID:brhz@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240101 +DTEND;VALUE=DATE:20240101 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: New Year's Day Holiday +END:VEVENT +BEGIN:VEVENT +UID:eqra@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240102 +DTEND;VALUE=DATE:20240102 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: New Year's Day Holiday +END:VEVENT +BEGIN:VEVENT +UID:n4fh@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240103 +DTEND;VALUE=DATE:20240103 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: New Year's Day Holiday +END:VEVENT +BEGIN:VEVENT +UID:7ere@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240104 +DTEND;VALUE=DATE:20240104 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: New Year's Day Holiday +END:VEVENT +BEGIN:VEVENT +UID:e144@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240106 +DTEND;VALUE=DATE:20240106 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Orthodox Christmas +END:VEVENT +BEGIN:VEVENT +UID:rh1l@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240107 +DTEND;VALUE=DATE:20240107 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Orthodox Christmas Holiday +END:VEVENT +BEGIN:VEVENT +UID:52hv@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240222 +DTEND;VALUE=DATE:20240222 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Defender of the Fatherland +END:VEVENT +BEGIN:VEVENT +UID:kzzg@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240307 +DTEND;VALUE=DATE:20240307 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Intl. Women's Day +END:VEVENT +BEGIN:VEVENT +UID:s482@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240430 +DTEND;VALUE=DATE:20240430 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Spring and Labor Day +END:VEVENT +BEGIN:VEVENT +UID:vqc0@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240508 +DTEND;VALUE=DATE:20240508 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Victory Day +END:VEVENT +BEGIN:VEVENT +UID:fpcl@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240611 +DTEND;VALUE=DATE:20240611 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Russia Day +END:VEVENT +BEGIN:VEVENT +UID:16sp@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20241103 +DTEND;VALUE=DATE:20241103 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Civil Unity Day +END:VEVENT +BEGIN:VEVENT +UID:2jtp@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20241231 +DTEND;VALUE=DATE:20241231 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: New Year's Day +END:VEVENT +BEGIN:VEVENT +UID:jfuk@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250101 +DTEND;VALUE=DATE:20250101 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: New Year's Day Holiday +END:VEVENT +BEGIN:VEVENT +UID:82e6@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250102 +DTEND;VALUE=DATE:20250102 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: New Year's Day Holiday +END:VEVENT +BEGIN:VEVENT +UID:zoha@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250103 +DTEND;VALUE=DATE:20250103 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: New Year's Day Holiday +END:VEVENT +BEGIN:VEVENT +UID:rr0h@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250104 +DTEND;VALUE=DATE:20250104 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: New Year's Day Holiday +END:VEVENT +BEGIN:VEVENT +UID:8712@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250106 +DTEND;VALUE=DATE:20250106 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Orthodox Christmas +END:VEVENT +BEGIN:VEVENT +UID:uq55@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250107 +DTEND;VALUE=DATE:20250107 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Orthodox Christmas Holiday +END:VEVENT +BEGIN:VEVENT +UID:hmvp@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250223 +DTEND;VALUE=DATE:20250223 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Defender of the Fatherland +END:VEVENT +BEGIN:VEVENT +UID:6wgm@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250309 +DTEND;VALUE=DATE:20250309 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Intl. Women's Day +END:VEVENT +BEGIN:VEVENT +UID:g3y7@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250430 +DTEND;VALUE=DATE:20250430 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Spring and Labor Day +END:VEVENT +BEGIN:VEVENT +UID:5u4o@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250508 +DTEND;VALUE=DATE:20250508 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Victory Day +END:VEVENT +BEGIN:VEVENT +UID:ruw2@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250611 +DTEND;VALUE=DATE:20250611 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Russia Day +END:VEVENT +BEGIN:VEVENT +UID:ui8c@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20251103 +DTEND;VALUE=DATE:20251103 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY: Civil Unity Day +END:VEVENT +END:VCALENDAR \ No newline at end of file diff --git a/tests/calendar/No_Prefix_Calendar.json b/tests/calendar/No_Prefix_Calendar.json new file mode 100644 index 0000000..4a8d41b --- /dev/null +++ b/tests/calendar/No_Prefix_Calendar.json @@ -0,0 +1,11 @@ +{ + "id": "No_Prefix_Calendar", + "linkGroupName": "No Prefix Calendar", + "calendars": [ + { + "url": "C:\\Users\\user\\OneDrive\\Desktop\\Internship_tasks\\final calmerg\\tests\\test_calendars\\San_Francisco_Public_Holidays.ics", + "prefix": "", + "override": false + } + ] +} \ No newline at end of file diff --git a/tests/calendar/Override_Calendar.ics b/tests/calendar/Override_Calendar.ics new file mode 100644 index 0000000..b3b2814 --- /dev/null +++ b/tests/calendar/Override_Calendar.ics @@ -0,0 +1,266 @@ +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//sebbo.net//ical-generator//EN +NAME:Override Calendar +X-WR-CALNAME:Override Calendar +BEGIN:VEVENT +UID:k61c@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20231231 +DTEND;VALUE=DATE:20231231 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:55y9@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240101 +DTEND;VALUE=DATE:20240101 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:skrq@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240102 +DTEND;VALUE=DATE:20240102 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:vz9m@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240103 +DTEND;VALUE=DATE:20240103 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:vhek@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240104 +DTEND;VALUE=DATE:20240104 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:n520@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240106 +DTEND;VALUE=DATE:20240106 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:lqmc@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240107 +DTEND;VALUE=DATE:20240107 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:qsw7@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240222 +DTEND;VALUE=DATE:20240222 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:cssb@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240307 +DTEND;VALUE=DATE:20240307 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:q1qz@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240430 +DTEND;VALUE=DATE:20240430 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:0bgv@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240508 +DTEND;VALUE=DATE:20240508 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:t8ux@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20240611 +DTEND;VALUE=DATE:20240611 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:uppu@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20241103 +DTEND;VALUE=DATE:20241103 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:m56r@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20241231 +DTEND;VALUE=DATE:20241231 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:ecvb@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250101 +DTEND;VALUE=DATE:20250101 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:vx0q@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250102 +DTEND;VALUE=DATE:20250102 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:jd9w@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250103 +DTEND;VALUE=DATE:20250103 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:yvdj@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250104 +DTEND;VALUE=DATE:20250104 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:b03t@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250106 +DTEND;VALUE=DATE:20250106 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:gqz5@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250107 +DTEND;VALUE=DATE:20250107 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:xd78@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250223 +DTEND;VALUE=DATE:20250223 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:2hbi@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250309 +DTEND;VALUE=DATE:20250309 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:3sa4@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250430 +DTEND;VALUE=DATE:20250430 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:w8qb@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250508 +DTEND;VALUE=DATE:20250508 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:x8kb@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20250611 +DTEND;VALUE=DATE:20250611 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +BEGIN:VEVENT +UID:wu7v@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART;VALUE=DATE:20251103 +DTEND;VALUE=DATE:20251103 +X-MICROSOFT-CDO-ALLDAYEVENT:TRUE +X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE +SUMMARY:Override Event +END:VEVENT +END:VCALENDAR \ No newline at end of file diff --git a/tests/calendar/Override_Calendar.json b/tests/calendar/Override_Calendar.json new file mode 100644 index 0000000..7e258d2 --- /dev/null +++ b/tests/calendar/Override_Calendar.json @@ -0,0 +1,11 @@ +{ + "id": "Override_Calendar", + "linkGroupName": "Override Calendar", + "calendars": [ + { + "url": "C:\\Users\\user\\OneDrive\\Desktop\\Internship_tasks\\final calmerg\\tests\\test_calendars\\San_Francisco_Public_Holidays.ics", + "prefix": "Override Event", + "override": true + } + ] +} \ No newline at end of file diff --git a/tests/calendar/Time_Based_Calendar.ics b/tests/calendar/Time_Based_Calendar.ics new file mode 100644 index 0000000..bd51162 --- /dev/null +++ b/tests/calendar/Time_Based_Calendar.ics @@ -0,0 +1,46 @@ +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//sebbo.net//ical-generator//EN +NAME:Time Based Calendar +X-WR-CALNAME:Time Based Calendar +BEGIN:VEVENT +UID:hexi@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART:20241001T183000Z +DTEND:20241001T193000Z +SUMMARY:other_work calmerge +END:VEVENT +BEGIN:VEVENT +UID:5gao@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART:20241010T173000Z +DTEND:20241010T183000Z +SUMMARY:other_work to do +END:VEVENT +BEGIN:VEVENT +UID:d67d@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART:20240930T113000Z +DTEND:20240930T123000Z +SUMMARY:work other work +END:VEVENT +BEGIN:VEVENT +UID:6kon@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART:20241003T190000Z +DTEND:20241003T200000Z +SUMMARY:work progodessey +END:VEVENT +BEGIN:VEVENT +UID:gxgt@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T002212Z +DTSTART:20241009T173000Z +DTEND:20241009T183000Z +SUMMARY:work do +END:VEVENT +END:VCALENDAR \ No newline at end of file diff --git a/tests/calendar/Time_Based_Calendar.json b/tests/calendar/Time_Based_Calendar.json new file mode 100644 index 0000000..896a70c --- /dev/null +++ b/tests/calendar/Time_Based_Calendar.json @@ -0,0 +1,16 @@ +{ + "id": "Time_Based_Calendar", + "linkGroupName": "Time Based Calendar", + "calendars": [ + { + "url": "C:\\Users\\user\\OneDrive\\Desktop\\Internship_tasks\\final calmerg\\tests\\test_calendars\\other_work.ics", + "prefix": "other_work", + "override": false + }, + { + "url": "C:\\Users\\user\\OneDrive\\Desktop\\Internship_tasks\\final calmerg\\tests\\test_calendars\\work.ics", + "prefix": "work", + "override": false + } + ] +} \ No newline at end of file