forked from ryanmwangi/CalMerger
test: run tests for nextcloud minimal alone first
This commit is contained in:
parent
585b83b03c
commit
8ab685dec0
|
@ -9,7 +9,7 @@ const EXPECTED_OUTPUTS_DIR = path.join(__dirname, 'expected_outputs');
|
||||||
|
|
||||||
let server;
|
let server;
|
||||||
process.chdir(__dirname)
|
process.chdir(__dirname)
|
||||||
console.log(process.cwd());
|
// console.log(process.cwd());
|
||||||
const app = require('../src/server').default;
|
const app = require('../src/server').default;
|
||||||
|
|
||||||
describe('Calendar Merging API', () => {
|
describe('Calendar Merging API', () => {
|
||||||
|
@ -51,7 +51,7 @@ describe('Calendar Merging API', () => {
|
||||||
expect(response.status).toBe(200);
|
expect(response.status).toBe(200);
|
||||||
// Check if the file was created in the test directory
|
// Check if the file was created in the test directory
|
||||||
const filePath = path.join(CALENDARS_DIR, 'nextcloud-minimal.ics');
|
const filePath = path.join(CALENDARS_DIR, 'nextcloud-minimal.ics');
|
||||||
console.log('Checking if file exists at:', filePath);
|
// console.log('Checking if file exists at:', filePath);
|
||||||
expect(fs.existsSync(filePath)).toBe(true);
|
expect(fs.existsSync(filePath)).toBe(true);
|
||||||
// Load expected output and compare
|
// Load expected output and compare
|
||||||
const expectedOutput = fs.readFileSync(input, 'utf8');
|
const expectedOutput = fs.readFileSync(input, 'utf8');
|
||||||
|
@ -59,30 +59,30 @@ describe('Calendar Merging API', () => {
|
||||||
expect(actualOutput).toBe(expectedOutput);
|
expect(actualOutput).toBe(expectedOutput);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Preserve date-based calendar', async () => {
|
// test('Preserve date-based calendar', async () => {
|
||||||
const input = getTestCalendarFilename('US_Holidays.ics');
|
// const input = getTestCalendarFilename('US_Holidays.ics');
|
||||||
const response = await request(server)
|
// const response = await request(server)
|
||||||
.post('/merge')
|
// .post('/merge')
|
||||||
.send({
|
// .send({
|
||||||
linkGroupName: 'US Holidays',
|
// linkGroupName: 'US Holidays',
|
||||||
calendars: [
|
// calendars: [
|
||||||
{
|
// {
|
||||||
url: input,
|
// url: input,
|
||||||
prefix: '',
|
// prefix: '',
|
||||||
override: false,
|
// override: false,
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
});
|
// });
|
||||||
expect(response.status).toBe(200);
|
// expect(response.status).toBe(200);
|
||||||
// Check if the file was created in the test directory
|
// // Check if the file was created in the test directory
|
||||||
const filePath = path.join(CALENDARS_DIR, 'US_Holidays.ics');
|
// const filePath = path.join(CALENDARS_DIR, 'US_Holidays.ics');
|
||||||
console.log('Checking if file exists at:', filePath);
|
// console.log('Checking if file exists at:', filePath);
|
||||||
expect(fs.existsSync(filePath)).toBe(true);
|
// expect(fs.existsSync(filePath)).toBe(true);
|
||||||
// Load expected output and compare
|
// // Load expected output and compare
|
||||||
const expectedOutput = fs.readFileSync(input, 'utf8');
|
// const expectedOutput = fs.readFileSync(input, 'utf8');
|
||||||
const actualOutput = fs.readFileSync(filePath, 'utf8');
|
// const actualOutput = fs.readFileSync(filePath, 'utf8');
|
||||||
expect(actualOutput).toBe(expectedOutput);
|
// expect(actualOutput).toBe(expectedOutput);
|
||||||
});
|
// });
|
||||||
|
|
||||||
// test('Merge date-based calendar', async () => {
|
// test('Merge date-based calendar', async () => {
|
||||||
// const response = await request(server)
|
// const response = await request(server)
|
||||||
|
@ -116,61 +116,61 @@ describe('Calendar Merging API', () => {
|
||||||
// expect(actualOutput).toBe(expectedOutput);
|
// expect(actualOutput).toBe(expectedOutput);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
test('Merge time-based calendar', async () => {
|
// test('Merge time-based calendar', async () => {
|
||||||
const input = getTestCalendarFilename('work_task_calendar.ics');
|
// const input = getTestCalendarFilename('work_task_calendar.ics');
|
||||||
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: input,
|
// url: input,
|
||||||
prefix: 'work_task',
|
// prefix: 'work_task',
|
||||||
override: false,
|
// override: false,
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
});
|
// });
|
||||||
|
|
||||||
expect(response.status).toBe(200);
|
// expect(response.status).toBe(200);
|
||||||
expect(response.body.url).toMatch(/calendar\/Time_Based_Calendar/);
|
// expect(response.body.url).toMatch(/calendar\/Time_Based_Calendar/);
|
||||||
|
|
||||||
// Check if the file was created in the test directory
|
// // Check if the file was created in the test directory
|
||||||
const filePath = path.join(CALENDARS_DIR, 'Time_Based_Calendar.ics');
|
// const filePath = path.join(CALENDARS_DIR, 'Time_Based_Calendar.ics');
|
||||||
expect(fs.existsSync(filePath)).toBe(true);
|
// expect(fs.existsSync(filePath)).toBe(true);
|
||||||
|
|
||||||
// Load expected output and compare
|
// // Load expected output and compare
|
||||||
const expectedOutput = fs.readFileSync(input, 'utf8');
|
// const expectedOutput = fs.readFileSync(input, 'utf8');
|
||||||
const actualOutput = fs.readFileSync(filePath, 'utf8');
|
// const actualOutput = fs.readFileSync(filePath, 'utf8');
|
||||||
expect(actualOutput).toBe(expectedOutput);
|
// expect(actualOutput).toBe(expectedOutput);
|
||||||
});
|
// });
|
||||||
|
|
||||||
test('EAT Event', async () => {
|
// test('EAT Event', async () => {
|
||||||
const input = getTestCalendarFilename('eat_time_zone_event.ics');
|
// const input = getTestCalendarFilename('eat_time_zone_event.ics');
|
||||||
const response = await request(server)
|
// const response = await request(server)
|
||||||
.post('/merge')
|
// .post('/merge')
|
||||||
.send({
|
// .send({
|
||||||
linkGroupName: 'EAT Event',
|
// linkGroupName: 'EAT Event',
|
||||||
calendars: [
|
// calendars: [
|
||||||
{
|
// {
|
||||||
url: input,
|
// url: input,
|
||||||
prefix: 'EAT Event',
|
// prefix: 'EAT Event',
|
||||||
override: false,
|
// override: false,
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
});
|
// });
|
||||||
|
|
||||||
expect(response.status).toBe(200);
|
// expect(response.status).toBe(200);
|
||||||
expect(response.body.url).toMatch(/calendar\/EAT_Event/);
|
// expect(response.body.url).toMatch(/calendar\/EAT_Event/);
|
||||||
|
|
||||||
// Check if the file was created in the test directory
|
// // Check if the file was created in the test directory
|
||||||
const filePath = path.join(CALENDARS_DIR, 'EAT_Event.ics');
|
// const filePath = path.join(CALENDARS_DIR, 'EAT_Event.ics');
|
||||||
expect(fs.existsSync(filePath)).toBe(true);
|
// expect(fs.existsSync(filePath)).toBe(true);
|
||||||
|
|
||||||
// Load expected output and compare
|
// // Load expected output and compare
|
||||||
const expectedOutput = fs.readFileSync(input, 'utf8');
|
// const expectedOutput = fs.readFileSync(input, 'utf8');
|
||||||
const actualOutput = fs.readFileSync(filePath, 'utf8');
|
// const actualOutput = fs.readFileSync(filePath, 'utf8');
|
||||||
expect(actualOutput).toBe(expectedOutput);
|
// expect(actualOutput).toBe(expectedOutput);
|
||||||
});
|
// });
|
||||||
|
|
||||||
// test('Merge calendar without prefix', async () => {
|
// test('Merge calendar without prefix', async () => {
|
||||||
// const response = await request(server)
|
// const response = await request(server)
|
||||||
|
|
Loading…
Reference in New Issue