fix: Future Limit Calculations (#15825)
This commit is contained in:
1 parent
c059d79a51
commit
06ce1988f3
5 files changed
+253
-91
No files matched your search
@@ -675,7 +675,6 @@ describe("getSchedule", () => {
|
||||
];
|
||||
|
||||
expect(scheduleForEvent).toHaveTimeSlots(
|
||||
// All slots on current day are available
|
||||
[
|
||||
// "2024-05-30T04:30:00.000Z", // Not available as before the start of the range
|
||||
"2024-05-31T04:30:00.000Z",
|
||||
@@ -1548,6 +1547,126 @@ describe("getSchedule", () => {
|
||||
dateString: plus4DateString,
|
||||
});
|
||||
});
|
||||
|
||||
describe("GMT-11 Browsing", () => {
|
||||
test("should show correct timeslots only for 24th and 25th July(of IST Timezone)", async () => {
|
||||
vi.setSystemTime(`2024-07-05T01:30:00Z`);
|
||||
|
||||
const scenarioData = {
|
||||
eventTypes: [
|
||||
{
|
||||
id: 1,
|
||||
length: 60,
|
||||
// Makes today and tomorrow only available
|
||||
...getPeriodTypeData({
|
||||
type: "RANGE",
|
||||
|
||||
// Only 25th and 26th(as per the event timezone(IST)) should be available
|
||||
periodStartDate: new Date(`2024-07-24T18:30:00.000Z`), // 25th July in IST
|
||||
periodEndDate: new Date(`2024-07-25T18:30:00.000Z`), // 26th July in IST
|
||||
|
||||
periodCountCalendarDays: true,
|
||||
}),
|
||||
users: [
|
||||
{
|
||||
id: 101,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
users: [
|
||||
{
|
||||
...TestData.users.example,
|
||||
id: 101,
|
||||
schedules: [TestData.schedules.IstWorkHours],
|
||||
},
|
||||
],
|
||||
} satisfies ScenarioData;
|
||||
|
||||
await createBookingScenario(scenarioData);
|
||||
|
||||
const scheduleForEventForPagoTz = await getSchedule({
|
||||
input: {
|
||||
eventTypeId: 1,
|
||||
eventTypeSlug: "",
|
||||
usernameList: [],
|
||||
startTime: `2024-06-30T18:30:00.000Z`,
|
||||
endTime: `2024-07-31T18:29:59.999Z`,
|
||||
timeZone: Timezones["-11:00"],
|
||||
isTeamEvent: false,
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Current day in test is 5th July, so verify that earlier timeslots than 24th July are disabled
|
||||
*/
|
||||
{
|
||||
expect(scheduleForEventForPagoTz).toHaveDateDisabled({
|
||||
dateString: "2024-07-21",
|
||||
});
|
||||
|
||||
expect(scheduleForEventForPagoTz).toHaveDateDisabled({
|
||||
dateString: "2024-07-22",
|
||||
});
|
||||
|
||||
expect(scheduleForEventForPagoTz).toHaveDateDisabled({
|
||||
dateString: "2024-07-23",
|
||||
});
|
||||
}
|
||||
|
||||
expect(scheduleForEventForPagoTz).toHaveTimeSlots(
|
||||
[
|
||||
"2024-07-25T04:30:00.000Z",
|
||||
"2024-07-25T05:30:00.000Z",
|
||||
"2024-07-25T06:30:00.000Z",
|
||||
"2024-07-25T07:30:00.000Z",
|
||||
"2024-07-25T08:30:00.000Z",
|
||||
"2024-07-25T09:30:00.000Z",
|
||||
"2024-07-25T10:30:00.000Z",
|
||||
],
|
||||
{
|
||||
// 25th timeslots are shown mostly on 24th of Pago Pago
|
||||
dateString: "2024-07-24",
|
||||
doExactMatch: true,
|
||||
}
|
||||
);
|
||||
|
||||
expect(scheduleForEventForPagoTz).toHaveTimeSlots(
|
||||
[
|
||||
"2024-07-25T11:30:00.000Z",
|
||||
"2024-07-26T04:30:00.000Z",
|
||||
"2024-07-26T05:30:00.000Z",
|
||||
"2024-07-26T06:30:00.000Z",
|
||||
"2024-07-26T07:30:00.000Z",
|
||||
"2024-07-26T08:30:00.000Z",
|
||||
"2024-07-26T09:30:00.000Z",
|
||||
"2024-07-26T10:30:00.000Z",
|
||||
],
|
||||
{
|
||||
dateString: "2024-07-25",
|
||||
doExactMatch: true,
|
||||
}
|
||||
);
|
||||
|
||||
expect(scheduleForEventForPagoTz).toHaveTimeSlots(["2024-07-26T11:30:00.000Z"], {
|
||||
dateString: "2024-07-26",
|
||||
doExactMatch: true,
|
||||
});
|
||||
|
||||
/**
|
||||
* Verify that timeslots beyond 26th July are disabled
|
||||
*/
|
||||
{
|
||||
expect(scheduleForEventForPagoTz).toHaveDateDisabled({
|
||||
dateString: "2024-07-27",
|
||||
});
|
||||
|
||||
expect(scheduleForEventForPagoTz).toHaveDateDisabled({
|
||||
dateString: "2024-07-28",
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user