mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 11:39:00 +00:00
test(work-orders): avoid unsupported array at helper
This commit is contained in:
parent
fdc275ab9a
commit
49be7ffbc6
1 changed files with 5 additions and 3 deletions
|
|
@ -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();
|
expect(await screen.findByRole("button", { name: "9" })).toBeDisabled();
|
||||||
fireEvent.keyDown(document.activeElement ?? document.body, { key: "Escape" });
|
fireEvent.keyDown(document.activeElement ?? document.body, { key: "Escape" });
|
||||||
|
|
||||||
const scheduleBlock = rowByLabel("Schedule On").parentElement!;
|
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" });
|
const calendars = await screen.findAllByRole("button", { name: "15" });
|
||||||
fireEvent.click(calendars.at(-1)!);
|
fireEvent.click(calendars[calendars.length - 1]);
|
||||||
|
|
||||||
expect(onPatch).toHaveBeenCalledWith(
|
expect(onPatch).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({ scheduledOn: day(15), dueDate: "" }),
|
expect.objectContaining({ scheduledOn: day(15), dueDate: "" }),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue