Removed code bloat, fixed tests

This commit is contained in:
Alex van Andel committed 2021-06-29 22:35:13 +00:00
1 parent 5d30586a24
commit 0da99f0d07
4 files changed
+16 -36

No files matched your search

+5 -22
View File
@@ -13,27 +13,10 @@ it('can fit 24 hourly slots for an empty day', async () => {
// 24h in a day.
expect(getSlots({
inviteeDate: dayjs().add(1, 'day'),
length: 60,
frequency: 60,
workingHours: [
{ days: [...Array(7).keys()], startTime: 0, endTime: 1440 }
],
organizerTimeZone: 'Europe/London'
})).toHaveLength(24);
});
it('has slots that be in the same timezone as the invitee', async() => {
expect(getSlots({
inviteeDate: dayjs().add(1, 'day'),
length: 60
})[0].utcOffset()).toBe(-0);
expect(getSlots({
inviteeDate: dayjs().tz('Europe/London').add(1, 'day'),
length: 60
})[0].utcOffset()).toBe(dayjs().tz('Europe/London').utcOffset());
})
it('excludes slots that have already passed when invitee day equals today', async () => {
expect(getSlots({ inviteeDate: dayjs(), length: 60 })).toHaveLength(12);
});
it('supports having slots in different utc offset than the invitee', async () => {
expect(getSlots({ inviteeDate: dayjs(), length: 60 })).toHaveLength(12);
expect(getSlots({ inviteeDate: dayjs().tz('Europe/Brussels'), length: 60 })).toHaveLength(14);
});