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 onApprove = vi.fn();
const onReject = vi.fn(); const onReject = vi.fn();
const onRevoke = vi.fn(); const onRevoke = vi.fn();
const onOpenAttachment = vi.fn();
renderWithProviders( renderWithProviders(
<UpliftDetailModal <UpliftDetailModal
item={{ ...baseItem, ...overrides }} item={{ ...baseItem, ...overrides }}
@ -64,9 +65,10 @@ function renderModal(overrides: Partial<UpliftQueueItem> = {}) {
onApprove={onApprove} onApprove={onApprove}
onReject={onReject} onReject={onReject}
onRevoke={onRevoke} onRevoke={onRevoke}
onOpenAttachment={onOpenAttachment}
/>, />,
); );
return { onApprove, onReject, onRevoke }; return { onApprove, onReject, onRevoke, onOpenAttachment };
} }
describe("UpliftDetailModal", () => { describe("UpliftDetailModal", () => {
@ -88,6 +90,19 @@ describe("UpliftDetailModal", () => {
expect(screen.getByText("No attachments")).toBeInTheDocument(); 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", () => { it("falls back to the work order uplifts for the approved-on-WO breakdown", () => {
renderModal(); renderModal();