mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-03 05:43:22 +00:00
Gate CompDoc on selected service, use real pm titles only, make Address editable via location update, and wire media to the board API with categories instead of blob state.
29 lines
1,003 B
TypeScript
29 lines
1,003 B
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { describe, expect, it, vi } from "vitest";
|
|
import { CompDocCell } from "@/app/(protected)/workorders/_components/list/table/cells/comp-doc-cell";
|
|
|
|
describe("CompDocCell service gate", () => {
|
|
it("shows a disabled placeholder when no service is selected", () => {
|
|
const onOpen = vi.fn();
|
|
render(<CompDocCell status="No" woType="PM" pm="" onOpen={onOpen} onOpenMedia={vi.fn()} />);
|
|
|
|
expect(screen.getByText("Select service")).toBeInTheDocument();
|
|
expect(screen.queryByRole("button", { name: /draft|view doc|n\/n/i })).not.toBeInTheDocument();
|
|
});
|
|
|
|
it("opens CompDoc when a service is selected", () => {
|
|
const onOpen = vi.fn();
|
|
render(
|
|
<CompDocCell
|
|
status="No"
|
|
woType="PM"
|
|
pm="HVAC Inspection"
|
|
onOpen={onOpen}
|
|
onOpenMedia={vi.fn()}
|
|
/>,
|
|
);
|
|
|
|
screen.getByRole("button", { name: /draft/i }).click();
|
|
expect(onOpen).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|