test(work-orders): avoid unsupported array at helper

This commit is contained in:
Codex Review Integration 2026-09-16 13:59:22 -03:00
parent fdc275ab9a
commit 49be7ffbc6

View file

@ -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: "" }),