test(sidebar): cover PO links moved under Purchasing + renames
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
29118aa88e
commit
2e8fd67805
1 changed files with 34 additions and 0 deletions
|
|
@ -100,3 +100,37 @@ describe("Sidebar collapsible sections", () => {
|
|||
expect(within(adminVendors).queryByText("Vendors")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Purchase Order links under Purchasing", () => {
|
||||
it("renders the renamed PO links inside the Purchasing section (not top-level)", () => {
|
||||
render(<Sidebar userRole="MANAGER" />);
|
||||
|
||||
// Collapsed by default → PO links are not in the DOM until Purchasing opens.
|
||||
expect(screen.queryByRole("link", { name: /New Purchase Order/i })).not.toBeInTheDocument();
|
||||
|
||||
fireEvent.click(headerButton("Purchasing"));
|
||||
|
||||
expect(screen.getByRole("link", { name: /New Purchase Order/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole("link", { name: /Closed Purchase Orders/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole("link", { name: /Import Purchase Order/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole("link", { name: /Purchase Order History/i })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("auto-expands Purchasing when a PO route is active", () => {
|
||||
mockPathname = "/po/new";
|
||||
render(<Sidebar userRole="MANAGER" />);
|
||||
|
||||
expect(headerButton("Purchasing")).toHaveAttribute("aria-expanded", "true");
|
||||
expect(screen.getByRole("link", { name: /New Purchase Order/i })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("drops the old PO labels", () => {
|
||||
render(<Sidebar userRole="MANAGER" />);
|
||||
fireEvent.click(headerButton("Purchasing"));
|
||||
|
||||
// Old labels were "New PO" / "Import PO" / "History".
|
||||
expect(screen.queryByRole("link", { name: /^New PO$/i })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("link", { name: /^Import PO$/i })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("link", { name: /^History$/i })).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue