This commit is contained in:
2026-07-12 21:26:08 +08:00
commit 9dd41afd48
502 changed files with 129901 additions and 0 deletions
@@ -0,0 +1,33 @@
import { describe, it } from "node:test";
import assert from "node:assert/strict";
import { applyCommunityEnter } from "../src/lib/graph-community-enter";
import type { GraphEngine, Selection } from "@llm-wiki/graph-engine";
describe("applyCommunityEnter", () => {
it("clears the prior selection highlight before focusing the community", () => {
const calls: string[] = [];
const selection: Selection = {
id: "community:alpha",
nodeIds: ["a1"],
communityIds: ["alpha"],
facts: { pageCount: 1, internalLinkCount: 0, communityCount: 1, isolatedCount: 1 },
input: { kind: "community", id: "alpha" },
actions: [],
};
const engine = {
clearSelection() {
calls.push("clear");
},
focusCommunity(id: string) {
calls.push(`focus:${id}`);
return selection;
},
} as unknown as GraphEngine;
const result = applyCommunityEnter(engine, "alpha");
assert.deepEqual(calls, ["clear", "focus:alpha"]);
assert.equal(result, null);
});
});