1 import { getValarmTrigger } from '@proton/shared/lib/calendar/alarms/getValarmTrigger';
2 import { NOTIFICATION_TYPE_API, NOTIFICATION_UNITS, NOTIFICATION_WHEN } from '@proton/shared/lib/calendar/constants';
3 import { toTriggerString } from '@proton/shared/lib/calendar/vcal';
5 const { DEVICE } = NOTIFICATION_TYPE_API;
6 const { DAY, HOUR, WEEK, MINUTE } = NOTIFICATION_UNITS;
7 const { BEFORE, AFTER } = NOTIFICATION_WHEN;
9 describe('model to properties positive trigger', () => {
10 test('0 minutes before', () => {
24 test('1 minute after', () => {
38 test('same day at 13:50', () => {
47 at: new Date(2000, 0, 1, 13, 50),
50 ).toEqual('PT13H50M');
53 test('1 day after at 00:00', () => {
62 at: new Date(2000, 0, 1, 0, 0),
68 test('1 day after at 13:50', () => {
77 at: new Date(2000, 0, 1, 13, 50),
80 ).toEqual('P1DT13H50M');
83 test('1 week after at 13:50', () => {
92 at: new Date(2000, 0, 1, 13, 50),
95 ).toEqual('P1WT13H50M');
99 describe('model to properties negative trigger', () => {
100 test('1 day before at 00:00', () => {
109 at: new Date(2000, 0, 1, 0, 0),
115 test('1 day before at 13:50', () => {
124 at: new Date(2000, 0, 1, 13, 50),
127 ).toEqual('-PT10H10M');
130 test('2 days before at 00:00', () => {
139 at: new Date(2000, 0, 1, 0, 0),
145 test('2 days before at 13:50', () => {
154 at: new Date(2000, 0, 1, 13, 50),
157 ).toEqual('-P1DT10H10M');
160 test('0 weeks before at 13:50', () => {
169 at: new Date(2000, 0, 1, 13, 50),
172 ).toEqual('-PT10H10M');
175 test('1 week before at 13:50', () => {
184 at: new Date(2000, 0, 1, 13, 50),
187 ).toEqual('-P6DT10H10M');
190 test('2 weeks before at 13:50', () => {
199 at: new Date(2000, 0, 1, 13, 50),
202 ).toEqual('-P1W6DT10H10M');
205 test('1 week before at 00:00', () => {
214 at: new Date(2000, 0, 1, 0, 0),
220 test('2 weeks before at 00:00', () => {
229 at: new Date(2000, 0, 1, 0, 0),
235 test('2 weeks before', () => {
249 test('15 minutes before', () => {
263 test('1 hour before', () => {