mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-02 02:43:12 +00:00
test(work-orders): assert all-weeks total and Clear All restores the bar
This commit is contained in:
parent
2c10d2b7cb
commit
2554e40fd8
1 changed files with 14 additions and 3 deletions
|
|
@ -59,8 +59,8 @@ vi.mock("@/app/(protected)/workorders/_hooks/use-work-orders-list-filters", () =
|
|||
vi.mock("@/app/(protected)/workorders/_hooks/use-work-orders-table-data", () => ({
|
||||
useWorkOrdersTableData: () => ({
|
||||
rows: [],
|
||||
totalCount: 0,
|
||||
scopeTotalCount: 0,
|
||||
totalCount: advApplied ? 42 : 0,
|
||||
scopeTotalCount: advApplied ? 42 : 0,
|
||||
isFetching: false,
|
||||
isLoading: false,
|
||||
setSelectedId: vi.fn(),
|
||||
|
|
@ -245,7 +245,7 @@ describe("WorkOrders Advanced Search page wiring (SH-121)", () => {
|
|||
|
||||
it("disables dispatcher, week, and type bar while advanced filters are applied", () => {
|
||||
advApplied = { ...EMPTY_ADVANCED_FILTERS, rescheduled: true };
|
||||
renderWithProviders(<WorkOrdersListPage />, {
|
||||
const view = renderWithProviders(<WorkOrdersListPage />, {
|
||||
route: "/workorders",
|
||||
withAuth: false,
|
||||
});
|
||||
|
|
@ -255,5 +255,16 @@ describe("WorkOrders Advanced Search page wiring (SH-121)", () => {
|
|||
expect(screen.getByRole("button", { name: "Next weeks" })).toBeDisabled();
|
||||
expect(screen.getByRole("button", { name: "All" })).toBeDisabled();
|
||||
expect(screen.getByRole("button", { name: "PM" })).toBeDisabled();
|
||||
expect(screen.getByText("42 work orders")).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: /clear all/i }));
|
||||
expect(clearAdvancedFilters).toHaveBeenCalled();
|
||||
|
||||
view.rerender(<WorkOrdersListPage />);
|
||||
|
||||
expect(screen.queryByText("42 work orders")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "All dispatchers" })).toBeEnabled();
|
||||
expect(screen.getByRole("button", { name: "All" })).toBeEnabled();
|
||||
expect(screen.getByRole("button", { name: "PM" })).toBeEnabled();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue