import type { ComponentProps } from "react"; import { renderToStaticMarkup } from "react-dom/server"; import { describe, expect, it, vi } from "vitest"; import { IssueRelatedWorkPanel } from "./IssueRelatedWorkPanel"; vi.mock("@/lib/router", () => ({ Link: ({ children, to, ...props }: ComponentProps<"a"> & { to: string }) => {children}, })); describe("IssueRelatedWorkPanel", () => { it("renders outbound and inbound related work with source labels", () => { const html = renderToStaticMarkup( , ); expect(html).toContain("References"); expect(html).toContain("Referenced by"); expect(html).toContain("PAP-22"); expect(html).toContain("PAP-33"); expect(html).toContain('aria-label="Issue PAP-22: Downstream task"'); expect(html).toContain('aria-label="Issue PAP-33: Upstream task"'); expect(html).toContain("plan"); expect(html).toContain("comment"); }); it("collapses duplicate source labels into a single chip with a count", () => { const html = renderToStaticMarkup( , ); const commentMatches = html.match(/>comment