mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-09-30 06:53:12 +00:00
test(work-orders): cover remaining SH-121 facets and document BE producer on dev
This commit is contained in:
parent
260f57ff23
commit
7902476e2a
2 changed files with 52 additions and 0 deletions
|
|
@ -93,6 +93,15 @@ Allowed `upliftStatuses`: `pending`, `approved`, `auto_approved`, `rejected` (ex
|
|||
|
||||
Exemplo: pending uplifts only — `hasUplift=true&upliftStatuses=pending`.
|
||||
|
||||
## Backend producer (`shoc-backend` `dev`)
|
||||
|
||||
These facet keys are handled on `GET /board/search` in `shoc-backend` `origin/dev` ([#45](https://github.com/Sea-Haven-Industries/shoc-backend/pull/45), [#65](https://github.com/Sea-Haven-Industries/shoc-backend/pull/65)). There is no frontend deployment fence.
|
||||
|
||||
- `IsAddOn` is owned by migration `20260730150000_WoIsAddOn` (legacy type-7 backfill).
|
||||
- `20260813193000_SH121_BoardSearchFacets` is a **no-op** so both PRs can land without a duplicate column.
|
||||
- Pagination matches this contract: `page` is 0-based; `pageSize` default/max is 100.
|
||||
- Aveta (`avetaOnly`) remains omitted until `avetaRequired` is confirmed.
|
||||
|
||||
### `datePreset`
|
||||
|
||||
| FE key | API value |
|
||||
|
|
|
|||
|
|
@ -197,4 +197,47 @@ describe("WorkOrders Advanced Search page wiring (SH-121)", () => {
|
|||
expect(params.hasUplift).toBe(true);
|
||||
expect(params.upliftStatuses).toEqual(["pending"]);
|
||||
});
|
||||
|
||||
it("applies Indicators, Flag, and Internal WO# through the public Advanced Filters sheet", () => {
|
||||
const view = renderWithProviders(<WorkOrdersListPage />, {
|
||||
route: "/workorders",
|
||||
withAuth: false,
|
||||
});
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Advanced Filters" }));
|
||||
advOpen = true;
|
||||
view.rerender(<WorkOrdersListPage />);
|
||||
|
||||
const sheet = screen.getByRole("dialog", { name: "Advanced Filters" });
|
||||
fireEvent.click(within(sheet).getByRole("button", { name: /Indicators/i }));
|
||||
fireEvent.click(within(sheet).getByRole("button", { name: /Rescheduled ≥ 2/i }));
|
||||
fireEvent.click(within(sheet).getByRole("button", { name: /Carried Over ≥ 2/i }));
|
||||
fireEvent.click(within(sheet).getByRole("button", { name: /^Add-On$/i }));
|
||||
|
||||
fireEvent.click(within(sheet).getByRole("button", { name: /^Flag$/i }));
|
||||
fireEvent.click(within(sheet).getByRole("button", { name: /^Red$/i }));
|
||||
|
||||
fireEvent.click(within(sheet).getByRole("button", { name: /Work Order Number/i }));
|
||||
fireEvent.click(within(sheet).getByRole("button", { name: /Internal numbers only/i }));
|
||||
|
||||
fireEvent.click(within(sheet).getByRole("button", { name: /apply filters/i }));
|
||||
|
||||
expect(applyAdvancedFilters).toHaveBeenCalled();
|
||||
const appliedCalls = applyAdvancedFilters.mock.calls;
|
||||
const applied = appliedCalls[appliedCalls.length - 1]?.[0] as typeof EMPTY_ADVANCED_FILTERS;
|
||||
expect(applied.rescheduled).toBe(true);
|
||||
expect(applied.carriedOver).toBe(true);
|
||||
expect(applied.addOn).toBe(true);
|
||||
expect(applied.flagColors.has("#EF4444")).toBe(true);
|
||||
expect(applied.internalOnly).toBe(true);
|
||||
|
||||
const params = toBoardSearchQueryParams({ filters: applied });
|
||||
expect(params.page).toBe(0);
|
||||
expect(params.pageSize).toBe(BOARD_SEARCH_MAX_PAGE_SIZE);
|
||||
expect(params.rescheduled).toBe(true);
|
||||
expect(params.carriedOver).toBe(true);
|
||||
expect(params.addOn).toBe(true);
|
||||
expect(params.flagColors).toEqual(["#EF4444"]);
|
||||
expect(params.internalOnly).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue