forked from PeronGH/simple-ics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.ts
71 lines (62 loc) · 1.49 KB
/
tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { Event, EventConfig, Calendar } from './mod.ts';
Deno.test({
name: 'event',
fn() {
const cfg: EventConfig = {
title: 'test',
beginDate: [2022, 8, 1, 10, 10],
endDate: [2022, 8, 1, 11, 10],
desc: 'Hello',
};
const evt = new Event(cfg);
console.log(evt.toLines());
},
});
Deno.test({
name: 'calendar',
fn() {
const cfg: EventConfig = {
title: 'test',
beginDate: [2022, 8, 1, 10, 10],
endDate: [2022, 8, 1, 11, 10],
};
const evt = new Event(cfg);
const calendar = new Calendar([evt]);
console.log(calendar.toLines());
},
});
Deno.test({
name: 'doc',
fn() {
const cfg1: EventConfig = {
title: 'Write Typescript',
beginDate: [2022, 9, 6, 9, 30],
endDate: [2022, 9, 6, 10],
desc: 'Implement a module to generate .ics files',
organizer: {
name: 'Sam Worthington',
email: 'sam@dev.com'
},
url: 'https://www.google.com/',
location: 'ABC Tank Warehouse',
geo: { lat: 10.4, lon: 44.5 }
};
const cfg2: EventConfig = {
title: 'Write Rust for 3 days',
beginDate: new Date(),
duration: 3600, // Duration: 3600s, or 1h
rrule: {
freq: 'DAILY',
count: 3,
},
alarm: {
desc: 'Write Rust NOW',
advance: 30,
},
};
const evt1 = new Event(cfg1);
const evt2 = new Event(cfg2);
const calendar = new Calendar([evt1, evt2]);
console.log(calendar.toString());
},
});