mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 02:22:06 +00:00
test(uplifts): cover detail evidence callback (SH-209)
This commit is contained in:
parent
5aed31392c
commit
6a2b9eb80c
1 changed files with 16 additions and 1 deletions
|
|
@ -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();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue