test: tighten session and skills assertions · openclaw/openclaw@a168fa9
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -523,7 +523,7 @@ describe("installSessionToolResultGuard", () => {
|
523 | 523 | |
524 | 524 | const persisted = getPersistedMessages(sm); |
525 | 525 | expect(persisted.map((message) => message.role)).toEqual(["user"]); |
526 | | -expect(persisted[0]).toMatchObject({ content: "second" }); |
| 526 | +expect((persisted[0] as { content?: unknown } | undefined)?.content).toBe("second"); |
527 | 527 | }); |
528 | 528 | |
529 | 529 | // When an assistant message with toolCalls is aborted, no synthetic toolResult |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -41,12 +41,8 @@ describe("guardSessionManager transcript updates", () => {
|
41 | 41 | } as AgentMessage); |
42 | 42 | |
43 | 43 | expect(updates).toHaveLength(1); |
44 | | -expect(updates[0]).toMatchObject({ |
45 | | - sessionFile, |
46 | | -sessionKey: "agent:main:worker", |
47 | | -message: { |
48 | | -role: "assistant", |
49 | | -}, |
50 | | -}); |
| 44 | +expect(updates[0]?.sessionFile).toBe(sessionFile); |
| 45 | +expect(updates[0]?.sessionKey).toBe("agent:main:worker"); |
| 46 | +expect((updates[0]?.message as { role?: string } | undefined)?.role).toBe("assistant"); |
51 | 47 | }); |
52 | 48 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -141,12 +141,10 @@ describe("buildWorkspaceSkillStatus", () => {
|
141 | 141 | expect(skill.eligible).toBe(false); |
142 | 142 | expect(skill.requirements.bins).toEqual(["fakebin"]); |
143 | 143 | expect(skill.missing.bins).toEqual(["fakebin"]); |
144 | | -expect(skill.install[0]).toMatchObject({ |
145 | | -id: "brew", |
146 | | -kind: "brew", |
147 | | -label: "Install fakebin", |
148 | | -bins: ["fakebin"], |
149 | | -}); |
| 144 | +expect(skill.install[0]?.id).toBe("brew"); |
| 145 | +expect(skill.install[0]?.kind).toBe("brew"); |
| 146 | +expect(skill.install[0]?.label).toBe("Install fakebin"); |
| 147 | +expect(skill.install[0]?.bins).toEqual(["fakebin"]); |
150 | 148 | }); |
151 | 149 | |
152 | 150 | it("respects OS-gated skills", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -68,13 +68,9 @@ describe("ensureSkillsWatcher", () => {
|
68 | 68 | expect(opts.ignored).toBe(refreshModule.shouldIgnoreSkillsWatchPath); |
69 | 69 | expect(opts.depth).toBe(2); |
70 | 70 | const posix = (p: string) => p.replaceAll("\\", "/"); |
71 | | -expect(targets).toEqual( |
72 | | -expect.arrayContaining([ |
73 | | -posix(path.join("/tmp/workspace", "skills")), |
74 | | -posix(path.join("/tmp/workspace", ".agents", "skills")), |
75 | | -posix(path.join(os.homedir(), ".agents", "skills")), |
76 | | -]), |
77 | | -); |
| 71 | +expect(targets).toContain(posix(path.join("/tmp/workspace", "skills"))); |
| 72 | +expect(targets).toContain(posix(path.join("/tmp/workspace", ".agents", "skills"))); |
| 73 | +expect(targets).toContain(posix(path.join(os.homedir(), ".agents", "skills"))); |
78 | 74 | const wildcardTargets = targets.filter((target) => target.includes("*")); |
79 | 75 | expect(wildcardTargets).toStrictEqual([]); |
80 | 76 | const ignored = refreshModule.shouldIgnoreSkillsWatchPath; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。