test(uplifts): cover detail evidence callback (SH-209)

This commit is contained in:
Codex Review Integration 2026-09-16 22:50:40 -03:00
parent 5aed31392c
commit 6a2b9eb80c

View file

@ -55,6 +55,7 @@ function renderModal(overrides: Partial<UpliftQueueItem> = {}) {
const onApprove = vi.fn();
const onReject = vi.fn();
const onRevoke = vi.fn();
const onOpenAttachment = vi.fn();
renderWithProviders(
<UpliftDetailModal
item={{ ...baseItem, ...overrides }}
@ -64,9 +65,10 @@ function renderModal(overrides: Partial<UpliftQueueItem> = {}) {
onApprove={onApprove}
onReject={onReject}
onRevoke={onRevoke}
onOpenAttachment={onOpenAttachment}
/>,
);
return { onApprove, onReject, onRevoke };
return { onApprove, onReject, onRevoke, onOpenAttachment };
}
describe("UpliftDetailModal", () => {
@ -88,6 +90,19 @@ describe("UpliftDetailModal", () => {
expect(screen.getByText("No attachments")).toBeInTheDocument();
});
it("opens an evidence attachment through the provided callback", () => {
const { onOpenAttachment } = renderModal({
evidenceDocumentId: "document-1",
evidenceFileName: "quote.pdf",
attachmentCount: 1,
});
fireEvent.click(screen.getByText("quote.pdf"));
expect(onOpenAttachment).toHaveBeenCalledWith(
expect.objectContaining({ evidenceDocumentId: "document-1" }),
);
});
it("falls back to the work order uplifts for the approved-on-WO breakdown", () => {
renderModal();