Files
prowler/ui/app/(prowler)/_overview/exploitability/_components/exploitability-chart.test.tsx
T

49 lines
1.5 KiB
TypeScript

import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { ExploitabilityChart } from "./exploitability-chart";
describe("ExploitabilityChart", () => {
it("leads with exploitable + likely and links each verdict into the list", () => {
render(
<ExploitabilityChart
counts={{
exploitable: 0,
likely: 3,
conditional: 4,
not_exploitable: 4,
unknown: 1,
}}
issues={12}
findings={37}
actionable={3}
scope={{ "filter[provider_type__in]": "aws" }}
/>,
);
expect(screen.getByText("12 issues")).toBeInTheDocument();
expect(
screen.getByRole("link", { name: "3 exploitable or likely issues" }),
).toHaveAttribute(
"href",
"/issues?filter%5Bprovider_type__in%5D=aws&filter%5Bverdict__in%5D=exploitable%2Clikely",
);
expect(screen.getByText("0 exploitable · 3 likely")).toBeInTheDocument();
expect(
screen.getByRole("link", { name: "4 not exploitable issues" }),
).toHaveAttribute(
"href",
"/issues?filter%5Bprovider_type__in%5D=aws&filter%5Bverdict%5D=not_exploitable",
);
expect(
screen.getByRole("link", { name: "4 conditional issues" }),
).toHaveAttribute(
"href",
"/issues?filter%5Bprovider_type__in%5D=aws&filter%5Bverdict%5D=conditional",
);
expect(
screen.getByText("37 failed findings folded into 12 issues"),
).toBeInTheDocument();
});
});