




















@@ -47,31 +47,36 @@ describe("applyMemoryWikiMutation", () => {
4747const page = await fs.readFile(path.join(rootDir, result.pagePath), "utf8");
4848const parsed = parseWikiMarkdown(page);
494950-expect(parsed.frontmatter).toMatchObject({
51-pageType: "synthesis",
52-id: "synthesis.alpha-synthesis",
53-title: "Alpha Synthesis",
54-sourceIds: ["source.alpha", "source.beta"],
55-claims: [
56-{
57-id: "claim.alpha.postgres",
58-text: "Alpha uses PostgreSQL for production writes.",
59-status: "supported",
60-confidence: 0.86,
61-evidence: [
62-{
63-sourceId: "source.alpha",
64-lines: "12-18",
65-weight: 0.9,
66-},
67-],
68-},
69-],
70-contradictions: ["Needs a better primary source"],
71-questions: ["What changed after launch?"],
72-confidence: 0.7,
73-status: "active",
74-});
50+expect(parsed.frontmatter.pageType).toBe("synthesis");
51+expect(parsed.frontmatter.id).toBe("synthesis.alpha-synthesis");
52+expect(parsed.frontmatter.title).toBe("Alpha Synthesis");
53+expect(parsed.frontmatter.sourceIds).toEqual(["source.alpha", "source.beta"]);
54+expect(parsed.frontmatter.claims).toHaveLength(1);
55+const claims = parsed.frontmatter.claims as
56+| Array<{
57+confidence?: number;
58+evidence?: Array<Record<string, unknown>>;
59+id?: string;
60+status?: string;
61+text?: string;
62+}>
63+| undefined;
64+const claim = claims?.[0];
65+expect(claim?.id).toBe("claim.alpha.postgres");
66+expect(claim?.text).toBe("Alpha uses PostgreSQL for production writes.");
67+expect(claim?.status).toBe("supported");
68+expect(claim?.confidence).toBe(0.86);
69+expect(claim?.evidence).toEqual([
70+{
71+sourceId: "source.alpha",
72+lines: "12-18",
73+weight: 0.9,
74+},
75+]);
76+expect(parsed.frontmatter.contradictions).toEqual(["Needs a better primary source"]);
77+expect(parsed.frontmatter.questions).toEqual(["What changed after launch?"]);
78+expect(parsed.frontmatter.confidence).toBe(0.7);
79+expect(parsed.frontmatter.status).toBe("active");
7580expect(parsed.body).toContain("## Summary");
7681expect(parsed.body).toContain("<!-- openclaw:wiki:generated:start -->");
7782expect(parsed.body).toContain("Alpha summary body.");
@@ -138,23 +143,27 @@ keep this note
138143const updated = await fs.readFile(targetPath, "utf8");
139144const parsed = parseWikiMarkdown(updated);
140145141-expect(parsed.frontmatter).toMatchObject({
142-pageType: "entity",
143-id: "entity.alpha",
144-title: "Alpha",
145-sourceIds: ["source.new"],
146-claims: [
147-{
148-id: "claim.alpha.status",
149-text: "Alpha is still active for existing tenants.",
150-status: "contested",
151-evidence: [{ sourceId: "source.new", lines: "4-9" }],
152-},
153-],
154-contradictions: ["Conflicts with source.beta"],
155-questions: ["Is Alpha still active?"],
156-status: "review",
157-});
146+expect(parsed.frontmatter.pageType).toBe("entity");
147+expect(parsed.frontmatter.id).toBe("entity.alpha");
148+expect(parsed.frontmatter.title).toBe("Alpha");
149+expect(parsed.frontmatter.sourceIds).toEqual(["source.new"]);
150+expect(parsed.frontmatter.claims).toHaveLength(1);
151+const claims = parsed.frontmatter.claims as
152+| Array<{
153+evidence?: Array<Record<string, unknown>>;
154+id?: string;
155+status?: string;
156+text?: string;
157+}>
158+| undefined;
159+const claim = claims?.[0];
160+expect(claim?.id).toBe("claim.alpha.status");
161+expect(claim?.text).toBe("Alpha is still active for existing tenants.");
162+expect(claim?.status).toBe("contested");
163+expect(claim?.evidence).toEqual([{ sourceId: "source.new", lines: "4-9" }]);
164+expect(parsed.frontmatter.contradictions).toEqual(["Conflicts with source.beta"]);
165+expect(parsed.frontmatter.questions).toEqual(["Is Alpha still active?"]);
166+expect(parsed.frontmatter.status).toBe("review");
158167expect(parsed.frontmatter).not.toHaveProperty("confidence");
159168expect(parsed.body).toContain("keep this note");
160169expect(parsed.body).toContain("<!-- openclaw:human:start -->");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。