forked from ryanmwangi/CalMerger
Compare commits
7 commits
00e152f08c
...
1f19d8cf1f
Author | SHA1 | Date | |
---|---|---|---|
|
1f19d8cf1f | ||
|
77e6963118 | ||
782e62d56d | |||
9468e58132 | |||
d4498cd0d8 | |||
3edc551031 | |||
859d3f3db5 |
6 changed files with 52 additions and 8 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -1 +1,2 @@
|
|||
* text=auto eol=lf
|
||||
*.ics text eol=crlf
|
||||
|
|
33
package-lock.json
generated
33
package-lock.json
generated
|
@ -12,6 +12,8 @@
|
|||
"axios": "^1.7.7",
|
||||
"calendar-merger": "file:",
|
||||
"express": "^4.17.1",
|
||||
"ical.js": "^2.1.0",
|
||||
"node-cron": "^2.0.3",
|
||||
"supertest": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -4306,6 +4308,11 @@
|
|||
"node": ">=10.17.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ical.js": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ical.js/-/ical.js-2.1.0.tgz",
|
||||
"integrity": "sha512-BOVfrH55xQ6kpS3muGvIXIg2l7p+eoe12/oS7R5yrO3TL/j/bLsR0PR+tYQESFbyTbvGgPHn9zQ6tI4FWyuSaQ=="
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
|
@ -5492,6 +5499,19 @@
|
|||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/node-cron": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/node-cron/-/node-cron-2.0.3.tgz",
|
||||
"integrity": "sha512-eJI+QitXlwcgiZwNNSRbqsjeZMp5shyajMR81RZCqeW0ZDEj4zU9tpd4nTh/1JsBiKbF8d08FCewiipDmVIYjg==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"opencollective-postinstall": "^2.0.0",
|
||||
"tz-offset": "0.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-int64": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
|
||||
|
@ -5570,6 +5590,14 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/opencollective-postinstall": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz",
|
||||
"integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==",
|
||||
"bin": {
|
||||
"opencollective-postinstall": "index.js"
|
||||
}
|
||||
},
|
||||
"node_modules/optionator": {
|
||||
"version": "0.9.4",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
|
||||
|
@ -6568,6 +6596,11 @@
|
|||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/tz-offset": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/tz-offset/-/tz-offset-0.0.1.tgz",
|
||||
"integrity": "sha512-kMBmblijHJXyOpKzgDhKx9INYU4u4E1RPMB0HqmKSgWG8vEcf3exEfLh4FFfzd3xdQOw9EuIy/cP0akY6rHopQ=="
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.19.8",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
"name": "calendar-merger",
|
||||
"version": "1.1.0",
|
||||
"scripts": {
|
||||
"start": "node src/app.js",
|
||||
"start": "node app.js",
|
||||
"test": "jest ./test"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.7.7",
|
||||
"calendar-merger": "file:",
|
||||
"express": "^4.17.1",
|
||||
"ical.js": "^2.1.0",
|
||||
"node-cron": "^2.0.3",
|
||||
"supertest": "^7.0.0"
|
||||
},
|
||||
"description": "calmerger",
|
||||
|
|
|
@ -342,3 +342,4 @@ const ICAL = require('./ical.js');
|
|||
register("TZID:Pacific/Tarawa\r\nLAST-MODIFIED:20241022T084017Z\r\nX-LIC-LOCATION:Pacific/Tarawa\r\nBEGIN:STANDARD\r\nTZNAME:%z\r\nTZOFFSETFROM:+1200\r\nTZOFFSETTO:+1200\r\nDTSTART:19700101T000000\r\nEND:STANDARD");
|
||||
register("TZID:Pacific/Tongatapu\r\nLAST-MODIFIED:20241022T084017Z\r\nX-LIC-LOCATION:Pacific/Tongatapu\r\nBEGIN:STANDARD\r\nTZNAME:%z\r\nTZOFFSETFROM:+1300\r\nTZOFFSETTO:+1300\r\nDTSTART:19700101T000000\r\nEND:STANDARD");
|
||||
})();
|
||||
export default ICAL;
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -33,12 +34,18 @@ describe('Calendar Utility Functions', () => {
|
|||
});
|
||||
|
||||
// Test case: reading data from a file
|
||||
it('reads data from a file', async () => {
|
||||
const testCalendar = { url: './test_calendars/eat_time_zone_event.ics' };
|
||||
// Call the fetchCalendarData function with the test calendar object
|
||||
it('reads and parses data from a file', async () => {
|
||||
const testCalendar = { url: path.join(__dirname, 'test_calendars', 'eat_time_zone_event.ics'), };
|
||||
|
||||
// Call the fetchCalendarData function
|
||||
const result = await fetchCalendarData(testCalendar);
|
||||
// Assert that the fetched result's data matches the expected file data
|
||||
expect(ICAL.parse(result.data)).toBe('file data');
|
||||
});
|
||||
|
||||
// Expected parsed output
|
||||
const expectedParsedData = '';
|
||||
|
||||
// Assert that the fetched and parsed data matches
|
||||
expect(ICAL.parse(result.data)).toEqual(expectedParsedData);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue