test: tighten tools catalog assertions · openclaw/openclaw@26b3260
steipete
·
2026-05-11
·
via Recent Commits to openclaw:main
File tree
src/gateway/server-methods
| Original file line number | Diff line number | Diff line change |
|---|
@@ -30,8 +30,8 @@ function expectWrittenSkillEntry(skillKey: string, entry: unknown) {
|
30 | 30 | entries?: Record<string, unknown>; |
31 | 31 | }; |
32 | 32 | }; |
33 | | -expect(Object.keys(config).sort()).toEqual(["skills"]); |
34 | | -expect(Object.keys(config.skills ?? {}).sort()).toEqual(["entries"]); |
| 33 | +expect(Object.keys(config).toSorted()).toEqual(["skills"]); |
| 34 | +expect(Object.keys(config.skills ?? {}).toSorted()).toEqual(["entries"]); |
35 | 35 | expect(config.skills?.entries?.[skillKey]).toEqual(entry); |
36 | 36 | } |
37 | 37 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -124,11 +124,9 @@ describe("tools.catalog handler", () => {
|
124 | 124 | const voiceCall = pluginGroups |
125 | 125 | .flatMap((group) => group.tools) |
126 | 126 | .find((tool) => tool.id === "voice_call"); |
127 | | -expect(voiceCall).toMatchObject({ |
128 | | -source: "plugin", |
129 | | -pluginId: "voice-call", |
130 | | -optional: true, |
131 | | -}); |
| 127 | +expect(voiceCall?.source).toBe("plugin"); |
| 128 | +expect(voiceCall?.pluginId).toBe("voice-call"); |
| 129 | +expect(voiceCall?.optional).toBe(true); |
132 | 130 | }); |
133 | 131 | |
134 | 132 | it("summarizes plugin tool descriptions the same way as the effective inventory", async () => { |
@@ -159,15 +157,12 @@ describe("tools.catalog handler", () => {
|
159 | 157 | |
160 | 158 | await invoke(); |
161 | 159 | |
162 | | -expect(vi.mocked(resolvePluginTools)).toHaveBeenCalledWith( |
163 | | -expect.objectContaining({ |
164 | | -allowGatewaySubagentBinding: true, |
165 | | -}), |
166 | | -); |
167 | | -expect(vi.mocked(ensureStandalonePluginToolRegistryLoaded)).toHaveBeenCalledWith( |
168 | | -expect.objectContaining({ |
169 | | -allowGatewaySubagentBinding: true, |
170 | | -}), |
| 160 | +expect(vi.mocked(resolvePluginTools).mock.calls[0]?.[0]?.allowGatewaySubagentBinding).toBe( |
| 161 | +true, |
171 | 162 | ); |
| 163 | +expect( |
| 164 | +vi.mocked(ensureStandalonePluginToolRegistryLoaded).mock.calls[0]?.[0] |
| 165 | +?.allowGatewaySubagentBinding, |
| 166 | +).toBe(true); |
172 | 167 | }); |
173 | 168 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。