Compare commits
No commits in common. "8ab685dec020ce902e3222bd6cbcb9ce4baddcd9" and "73e46d7f994c81f83af372f0bae4f9ceb6a67285" have entirely different histories.
8ab685dec0
...
73e46d7f99
2 changed files with 75 additions and 76 deletions
|
@ -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)
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
BEGIN:VCALENDAR
|
BEGIN:VCALENDAR
|
||||||
NAME:nextcloud-minimal
|
|
||||||
VERSION:2.0
|
VERSION:2.0
|
||||||
CALSCALE:GREGORIAN
|
CALSCALE:GREGORIAN
|
||||||
PRODID:-//CalMerge//Calendar Merger 1.0//EN
|
PRODID:-//SabreDAV//SabreDAV//EN
|
||||||
BEGIN:VTIMEZONE
|
BEGIN:VTIMEZONE
|
||||||
TZID:Europe/Berlin
|
TZID:Europe/Berlin
|
||||||
BEGIN:DAYLIGHT
|
BEGIN:DAYLIGHT
|
||||||
|
|
Loading…
Add table
Reference in a new issue