1 import { FREQUENCY } from '../../../lib/calendar/constants';
2 import { getIsRruleSubset } from '../../../lib/calendar/recurrence/rruleSubset';
4 const getTest = (a, b, result) => ({
10 describe('rrule subset', () => {
13 value: { year: 2021, month: 1, day: 6, hours: 12, minutes: 0, seconds: 0, isUTC: false },
14 parameters: { tzid: 'America/New_York' },
18 value: { year: 2021, month: 1, day: 10, hours: 23, minutes: 59, seconds: 59, isUTC: false },
19 parameters: { tzid: 'America/New_York' },
23 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY, count: 10 } } },
24 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY } } },
28 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY, interval: 2 } } },
29 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY } } },
33 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY, interval: 2, until: dummyUntil } } },
34 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY, until: dummyUntil } } },
40 rrule: { value: { freq: FREQUENCY.WEEKLY, byday: ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'] } },
42 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY } } },
46 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.WEEKLY, byday: ['WE', 'FR', 'SU'], count: 3 } } },
47 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY, interval: 2, count: 3 } } },
51 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY } } },
52 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY, count: 10 } } },
56 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY, interval: 2 } } },
57 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.DAILY, interval: 3 } } },
61 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.MONTHLY, byday: 'WE', bysetpos: 1 } } },
62 { ...dummyVevent, rrule: { value: { freq: FREQUENCY.MONTHLY } } },
68 value: { year: 2020, month: 1, day: 6, hours: 12, minutes: 0, seconds: 0, isUTC: false },
69 parameters: { tzid: 'America/New_York' },
73 freq: FREQUENCY.WEEKLY,
75 byday: ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'],
82 value: { year: 2020, month: 1, day: 6, hours: 12, minutes: 0, seconds: 0, isUTC: false },
83 parameters: { tzid: 'America/New_York' },
87 freq: FREQUENCY.WEEKLY,
89 byday: ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'],
95 ].forEach(({ a, b, result }, i) => {
96 it(`is rrule subset for ${i}`, () => {
97 expect(getIsRruleSubset(a, b)).toEqual(result);