import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it, vi } from "vitest";
import { EntityRow } from "./EntityRow";
vi.mock("@/lib/router", () => ({
Link: ({ children, to, ...props }: React.ComponentProps<"a"> & { to: string }) => (
{children}
),
}));
describe("EntityRow", () => {
it("keeps caller text color classes on linked rows", () => {
const markup = renderToStaticMarkup(
,
);
expect(markup).toContain("text-foreground/55");
expect(markup).not.toContain("text-inherit");
});
it("renders an optional meta slot and stops the title from flex-growing", () => {
const markup = renderToStaticMarkup(
gpt-5.4}
trailing={badge}
/>,
);
// meta content renders alongside trailing
expect(markup).toContain("meta-cell");
expect(markup).toContain("trailing-cell");
// a flex-1 spacer is inserted (between meta and trailing); the title block
// itself no longer flex-grows
expect(markup).toContain('class="flex-1"');
expect(markup).not.toContain("min-w-0 flex-1");
});
it("keeps the title flex-growing when no meta is provided", () => {
const markup = renderToStaticMarkup();
expect(markup).toContain("min-w-0 flex-1");
});
});