fix: Return empty available days if error querying calendar (#22828)
* Return a busy block placeholder if calendar throws an error * Refactor `getCalendarsEvents` to return an object with a success prop * Throw error in `getBusyTimes` if failed to fetch calendar availability * Return empty available days if error getting busy times * yeet. * Type fix * Fix type error in getLuckyUsers * Type fixes * Type fix * Type fix * Fix test * Fix test mocks * Refactor calendars.service to use new calendarBusyTimesQuery --------- Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
1 parent
82063cc9a1
commit
f7b201b0b5
8 files changed
+131
-90
No files matched your search
@@ -1281,12 +1281,15 @@ describe("getSchedule", () => {
|
||||
const { dateString: plus2DateString } = getDate({ dateIncrement: 2 });
|
||||
const { dateString: plus3DateString } = getDate({ dateIncrement: 3 });
|
||||
|
||||
CalendarManagerMock.getBusyCalendarTimes.mockResolvedValue([
|
||||
{
|
||||
start: `${plus3DateString}T04:00:00.000Z`,
|
||||
end: `${plus3DateString}T05:59:59.000Z`,
|
||||
},
|
||||
]);
|
||||
CalendarManagerMock.getBusyCalendarTimes.mockResolvedValue({
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
start: `${plus3DateString}T04:00:00.000Z`,
|
||||
end: `${plus3DateString}T05:59:59.000Z`,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const scenarioData = {
|
||||
eventTypes: [
|
||||
@@ -1347,12 +1350,15 @@ describe("getSchedule", () => {
|
||||
const { dateString: plus2DateString } = getDate({ dateIncrement: 2 });
|
||||
const { dateString: plus3DateString } = getDate({ dateIncrement: 3 });
|
||||
|
||||
CalendarManagerMock.getBusyCalendarTimes.mockResolvedValue([
|
||||
{
|
||||
start: `${plus3DateString}T04:00:00.000Z`,
|
||||
end: `${plus3DateString}T05:59:59.000Z`,
|
||||
},
|
||||
]);
|
||||
CalendarManagerMock.getBusyCalendarTimes.mockResolvedValue({
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
start: `${plus3DateString}T04:00:00.000Z`,
|
||||
end: `${plus3DateString}T05:59:59.000Z`,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const scenarioData = {
|
||||
eventTypes: [
|
||||
@@ -1421,7 +1427,7 @@ describe("getSchedule", () => {
|
||||
const { dateString: plus1DateString } = getDate({ dateIncrement: 1 });
|
||||
const { dateString: plus2DateString } = getDate({ dateIncrement: 2 });
|
||||
|
||||
CalendarManagerMock.getBusyCalendarTimes.mockResolvedValue([]);
|
||||
CalendarManagerMock.getBusyCalendarTimes.mockResolvedValue({ success: true, data: [] });
|
||||
|
||||
const scenarioData = {
|
||||
eventTypes: [
|
||||
|
||||
Reference in new issue
Block a user