Files
deusdata--codebase-memory-mcp/graph-ui/src/components/GraphTab.test.ts
T
wehub-resource-sync 41cb1c0170
OpenSSF Scorecard / scorecard (push) Failing after 0s
DCO / dco (push) Failing after 0s
CodeQL SAST / analyze (push) Failing after 1s
Deploy Pages / deploy (push) Failing after 1s
chore: import upstream snapshot with attribution
2026-07-13 12:28:05 +08:00

37 lines
951 B
TypeScript

import { describe, expect, it } from "vitest";
import { formatGraphLimitNotice } from "./GraphTab";
import type { GraphData } from "../lib/types";
describe("formatGraphLimitNotice", () => {
it("reports when the graph response is truncated for render safety", () => {
const data = {
nodes: Array.from({ length: 2000 }, (_, id) => ({
id,
x: 0,
y: 0,
z: 0,
label: "Function",
name: `fn${id}`,
size: 1,
color: "#ffffff",
})),
edges: [],
total_nodes: 43729,
} satisfies GraphData;
expect(formatGraphLimitNotice(data)).toBe(
"Showing 2,000 of 43,729 nodes (0 edges). Raise the node budget or use filters.",
);
});
it("stays quiet when the full graph is rendered", () => {
const data = {
nodes: [],
edges: [],
total_nodes: 0,
} satisfies GraphData;
expect(formatGraphLimitNotice(data)).toBeNull();
});
});