Compare commits

...

2 Commits

Author SHA1 Message Date
Ryan Mwangi a61ae491fa test listen on available port 2024-10-30 14:54:19 +03:00
Ryan Mwangi bed191c7b7 declare server variable 2024-10-30 14:23:44 +03:00
1 changed files with 4 additions and 1 deletions

View File

@ -11,7 +11,7 @@ let server;
describe('Calendar Merging API', () => {
beforeAll(async () => {
// Start the server
server = app.listen(0, () => {
server = app.listen(0);
console.log(`Server started on port 3000`);
});
// Ensure the merged calendars directory exists
@ -45,6 +45,7 @@ describe('Calendar Merging API', () => {
const filePath = path.join(MERGED_CALENDARS_DIR, 'Date_Based_Calendar.ics');
expect(fs.existsSync(filePath)).toBe(true);
});
test('Merge time-based calendar', async () => {
const response = await request(app)
.post('/merge')
@ -66,6 +67,7 @@ describe('Calendar Merging API', () => {
const filePath = path.join(MERGED_CALENDARS_DIR, 'Time_Based_Calendar.ics');
expect(fs.existsSync(filePath)).toBe(true);
});
test('Merge calendar without prefix', async () => {
const response = await request(app)
.post('/merge')
@ -87,6 +89,7 @@ describe('Calendar Merging API', () => {
const filePath = path.join(MERGED_CALENDARS_DIR, 'No_Prefix_Calendar.ics');
expect(fs.existsSync(filePath)).toBe(true);
});
test('Merge calendar with override', async () => {
const response = await request(app)
.post('/merge')