fix: Remove the Approved From and Approved to search field #137
1 changed files with 36 additions and 0 deletions
36
App/tests/unit/history-filters.test.tsx
Normal file
36
App/tests/unit/history-filters.test.tsx
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import { describe, it, expect, vi } from "vitest";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
|
||||
// HistoryFilters reads the URL via next/navigation; mock both hooks it uses.
|
||||
vi.mock("next/navigation", () => ({
|
||||
useRouter: () => ({ push: vi.fn(), refresh: vi.fn() }),
|
||||
useSearchParams: () => new URLSearchParams(""),
|
||||
}));
|
||||
|
||||
import { HistoryFilters } from "@/app/(portal)/history/history-filters";
|
||||
|
||||
const props = {
|
||||
vessels: [{ id: "v1", name: "Vessel One" }],
|
||||
accounts: [],
|
||||
perPageOptions: [25, 50, 100],
|
||||
defaultPerPage: 25,
|
||||
};
|
||||
|
||||
describe("HistoryFilters", () => {
|
||||
// Regression guard for issue #136: the "Approved From" / "Approved To" date
|
||||
// filters were removed from PO History. They must not reappear.
|
||||
it("does not render the Approved From / Approved To filters", () => {
|
||||
render(<HistoryFilters {...props} />);
|
||||
expect(screen.queryByText("Approved From")).toBeNull();
|
||||
expect(screen.queryByText("Approved To")).toBeNull();
|
||||
});
|
||||
|
||||
it("still renders the remaining filters (created-date range, cost centre, accounting code, status)", () => {
|
||||
render(<HistoryFilters {...props} />);
|
||||
expect(screen.getByText("From")).toBeInTheDocument();
|
||||
expect(screen.getByText("To")).toBeInTheDocument();
|
||||
expect(screen.getByText("Cost Centre")).toBeInTheDocument();
|
||||
expect(screen.getByText("Accounting Code")).toBeInTheDocument();
|
||||
expect(screen.getByText("Status")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue