diff --git a/src/test/app/(protected)/workorders/due-date-schedule-floor.test.tsx b/src/test/app/(protected)/workorders/due-date-schedule-floor.test.tsx index 32c1092e..e6c41d50 100644 --- a/src/test/app/(protected)/workorders/due-date-schedule-floor.test.tsx +++ b/src/test/app/(protected)/workorders/due-date-schedule-floor.test.tsx @@ -107,14 +107,16 @@ describe("Due Date cannot be before Schedule On (SH-356)", () => { />, ); - fireEvent.click(within(rowByLabel("Due Date").parentElement!).getAllByRole("button").at(-1)!); + const dueDateButtons = within(rowByLabel("Due Date").parentElement!).getAllByRole("button"); + fireEvent.click(dueDateButtons[dueDateButtons.length - 1]); expect(await screen.findByRole("button", { name: "9" })).toBeDisabled(); fireEvent.keyDown(document.activeElement ?? document.body, { key: "Escape" }); const scheduleBlock = rowByLabel("Schedule On").parentElement!; - fireEvent.click(within(scheduleBlock).getAllByRole("button").at(-1)!); + const scheduleButtons = within(scheduleBlock).getAllByRole("button"); + fireEvent.click(scheduleButtons[scheduleButtons.length - 1]); const calendars = await screen.findAllByRole("button", { name: "15" }); - fireEvent.click(calendars.at(-1)!); + fireEvent.click(calendars[calendars.length - 1]); expect(onPatch).toHaveBeenCalledWith( expect.objectContaining({ scheduledOn: day(15), dueDate: "" }),