diff --git a/test/calendar.test.js b/test/calendar.test.js index 4619b89..6f9614f 100644 --- a/test/calendar.test.js +++ b/test/calendar.test.js @@ -2,6 +2,12 @@ import request from 'supertest'; import express from 'express'; import fs from 'fs'; import path from 'path'; +import { jest } from '@jest/globals'; +import { fileURLToPath } from 'url'; + +// ESM equivalent of __dirname +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); const CALENDARS_DIR = path.join(__dirname, 'calendar'); const TEST_CALENDARS_DIR = path.join(__dirname, 'test_calendars'); @@ -10,7 +16,7 @@ const EXPECTED_OUTPUTS_DIR = path.join(__dirname, 'expected_outputs'); let server; process.chdir(__dirname) // console.log(process.cwd()); -const app = require('../src/server').default; +import app from '../src/server.js'; const normalizeLineEndings = (str) => str.replace(/\r\n/g, '\r\n').trimEnd(); // Normalize to CRLF diff --git a/test/calendarUtil.test.js b/test/calendarUtil.test.js index 63c30d0..9fd584a 100644 --- a/test/calendarUtil.test.js +++ b/test/calendarUtil.test.js @@ -2,6 +2,12 @@ import ICAL from '../src/lib/ical.timezones'; import fs from 'fs'; import path from 'path'; import axios from 'axios'; +import { jest } from '@jest/globals'; +import { fileURLToPath } from 'url'; + +// ESM equivalent of __dirname +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); // Describe the test suite for Calendar Utility Functions describe('Calendar Utility Functions', () => {