Bugfix/year change (#1323)

This commit is contained in:
Alex van Andel authored and GitHub committed 2021-12-16 15:20:38 +00:00
1 parent e6f71c81bb
commit a3bd226347
6 files changed
+132 -110

No files matched your search

+24 -5
View File
@@ -16,7 +16,7 @@ it("can fit 24 hourly slots for an empty day", async () => {
// 24h in a day.
expect(
getSlots({
inviteeDate: dayjs().add(1, "day"),
inviteeDate: dayjs.utc().add(1, "day").startOf("day"),
frequency: 60,
minimumBookingNotice: 0,
workingHours: [
@@ -30,11 +30,12 @@ it("can fit 24 hourly slots for an empty day", async () => {
).toHaveLength(24);
});
it.skip("only shows future booking slots on the same day", async () => {
// TODO: This test is sound; it should pass!
it("only shows future booking slots on the same day", async () => {
// The mock date is 1s to midday, so 12 slots should be open given 0 booking notice.
expect(
getSlots({
inviteeDate: dayjs(),
inviteeDate: dayjs.utc(),
frequency: 60,
minimumBookingNotice: 0,
workingHours: [
@@ -65,7 +66,7 @@ it("can cut off dates that due to invitee timezone differences fall on the next
).toHaveLength(0);
});
it.skip("can cut off dates that due to invitee timezone differences fall on the previous day", async () => {
it("can cut off dates that due to invitee timezone differences fall on the previous day", async () => {
const workingHours = [
{
days: [0],
@@ -75,10 +76,28 @@ it.skip("can cut off dates that due to invitee timezone differences fall on the
];
expect(
getSlots({
inviteeDate: dayjs().startOf("day"), // time translation -01:00
inviteeDate: dayjs().tz("Atlantic/Cape_Verde").startOf("day"), // time translation -01:00
frequency: 60,
minimumBookingNotice: 0,
workingHours,
})
).toHaveLength(0);
});
it("adds minimum booking notice correctly", async () => {
// 24h in a day.
expect(
getSlots({
inviteeDate: dayjs.utc().add(1, "day").startOf("day"),
frequency: 60,
minimumBookingNotice: 1500,
workingHours: [
{
days: Array.from(Array(7).keys()),
startTime: MINUTES_DAY_START,
endTime: MINUTES_DAY_END,
},
],
})
).toHaveLength(11);
});