From 77e6963118e0dbd5affca21b28f18c5c69bf24ca Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 18 Nov 2024 13:00:24 +0100 Subject: [PATCH] test: fix calendar paths --- test/calendar.test.js | 2 +- test/calendarUtil.test.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/test/calendar.test.js b/test/calendar.test.js index 770c076..5a463f8 100644 --- a/test/calendar.test.js +++ b/test/calendar.test.js @@ -3,7 +3,7 @@ import express from 'express'; import fs from 'fs'; import path from 'path'; -const CALENDARS_DIR = path.join(__dirname, 'calendar') +const CALENDARS_DIR = path.join(__dirname, 'calendar'); const TEST_CALENDARS_DIR = path.join(__dirname, 'test_calendars'); const EXPECTED_OUTPUTS_DIR = path.join(__dirname, 'expected_outputs'); diff --git a/test/calendarUtil.test.js b/test/calendarUtil.test.js index 9580a32..1e03b1d 100644 --- a/test/calendarUtil.test.js +++ b/test/calendarUtil.test.js @@ -1,5 +1,6 @@ import ICAL from '../src/lib/ical.timezones'; import fs from 'fs'; +import path from 'path'; import axios from 'axios'; // Describe the test suite for Calendar Utility Functions @@ -34,15 +35,13 @@ describe('Calendar Utility Functions', () => { // Test case: reading data from a file it('reads and parses data from a file', async () => { - const testCalendar = { url: './test/test_calendars/eat_time_zone_event.ics' }; + const testCalendar = { url: path.join(__dirname, 'test_calendars', 'eat_time_zone_event.ics'), }; // Call the fetchCalendarData function const result = await fetchCalendarData(testCalendar); // Expected parsed output - const expectedParsedData = ICAL.parse( - fs.readFileSync(testCalendar.url, 'utf-8') - ); + const expectedParsedData = ''; // Assert that the fetched and parsed data matches expect(ICAL.parse(result.data)).toEqual(expectedParsedData);