1 import { parse } from '@proton/shared/lib/calendar/vcal';
2 import type { VcalVeventComponent } from '@proton/shared/lib/interfaces/calendar';
4 import { propertiesToModel } from './propertiesToModel';
6 describe('properties to model', () => {
7 test('can parse start and end time correctly', () => {
8 const VEVENT = `BEGIN:VEVENT
9 DTSTART;TZID=America/New_York:20190719T120000
10 DTEND;TZID=Europe/Zurich:20190719T183000
15 veventComponent: parse(VEVENT) as VcalVeventComponent,
16 hasDefaultNotifications: true,
18 isProtonProtonInvite: false,
19 tzid: 'Europe/Zurich',
24 date: new Date(2019, 6, 19),
25 time: new Date(2000, 0, 1, 12),
26 tzid: 'America/New_York',
29 date: new Date(2019, 6, 19),
30 time: new Date(2000, 0, 1, 18, 30),
31 tzid: 'Europe/Zurich',
36 test('it allows end before start in part day event', () => {
37 const VEVENT = `BEGIN:VEVENT
38 DTSTART;TZID=Europe/Zurich:20190719T120000
39 DTEND;TZID=Europe/Zurich:20190719T110000
43 veventComponent: parse(VEVENT) as VcalVeventComponent,
44 hasDefaultNotifications: true,
46 isProtonProtonInvite: false,
47 tzid: 'Europe/Zurich',
51 date: new Date(2019, 6, 19),
52 time: new Date(2000, 0, 1, 12),
53 tzid: 'Europe/Zurich',
56 date: new Date(2019, 6, 19),
57 time: new Date(2000, 0, 1, 11),
58 tzid: 'Europe/Zurich',
63 test('it allows end before start in full day event', () => {
64 const VEVENT = `BEGIN:VEVENT
65 DTSTART;VALUE=DATE:20190719
66 DTEND;VALUE=DATE:20190718
70 veventComponent: parse(VEVENT) as VcalVeventComponent,
71 hasDefaultNotifications: true,
73 isProtonProtonInvite: false,
74 tzid: 'Europe/Zurich',
78 date: new Date(2019, 6, 19),
79 time: new Date(2000, 0, 1, 0),
82 date: new Date(2019, 6, 17),
83 time: new Date(2000, 0, 1, 0),