Skip to content

fix: prevent slot availability when calendar services fail #21987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe("isTimeSlotAvailable", () => {
expect(result).toBe(false);
});

it("should return true when scheduleData is null", () => {
it("should return false when scheduleData is null (fail-safe behavior)", () => {
const slotToCheckInIso = "2024-02-08T10:30:00.000Z";
const quickAvailabilityChecks: QuickAvailabilityCheck[] = [];

Expand All @@ -37,7 +37,7 @@ describe("isTimeSlotAvailable", () => {
quickAvailabilityChecks,
});

expect(result).toBe(true);
expect(result).toBe(false);
});

it("should return true when the date doesn't exist in the schedule data", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ export const isTimeSlotAvailable = ({

if (isUnavailableAsPerQuickCheck) return false;

// If schedule is not loaded or other variables are unavailable consider the slot available
// If schedule is not loaded or other variables are unavailable, fail-safe to prevent double bookings
if (!scheduleData) {
return true;
return false;
}

const dateInGMT = isValidISOFormat(slotToCheckInIso) ? slotToCheckInIso.split("T")[0] : null;
Expand Down
Loading