import { render, screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import type { IssueAttributes } from "@/types/issues"; const { getIssue, getIssueFindings } = vi.hoisted(() => ({ getIssue: vi.fn(), getIssueFindings: vi.fn(), })); vi.mock("next/navigation", () => ({ useRouter: () => ({ refresh: vi.fn() }) })); vi.mock("@/actions/issues", () => ({ getIssue, getIssueFindings })); vi.mock("@/components/issues/issue-graph", () => ({ IssueGraph: () =>
graph
, })); import { IssueAttackPath } from "./issue-attack-path"; const issue = { legs: {} } as IssueAttributes; describe("IssueAttackPath", () => { it("says there is nothing to draw, not a load error, without resources", async () => { // Given: no resources, and findings that cannot load without a scan getIssue.mockResolvedValue({ data: { attributes: { resource_uids: [], finding_uids: ["f1"] } }, }); // When render(