test: tighten skills assertions · openclaw/openclaw@8c4c128
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -318,19 +318,13 @@ describe("buildWorkspaceSkillCommandSpecs", () => {
|
318 | 318 | config, |
319 | 319 | }); |
320 | 320 | |
321 | | -expect(commands).toEqual( |
322 | | -expect.arrayContaining([ |
323 | | -expect.objectContaining({ |
324 | | -name: "workflows_review", |
325 | | -skillName: "workflows:review", |
326 | | -description: "Review code with a structured checklist", |
327 | | -promptTemplate: "Review the branch carefully.", |
328 | | -}), |
329 | | -]), |
| 321 | +const command = commands.find((entry) => entry.skillName === "workflows:review"); |
| 322 | +expect(command?.name).toBe("workflows_review"); |
| 323 | +expect(command?.description).toBe("Review code with a structured checklist"); |
| 324 | +expect(command?.promptTemplate).toBe("Review the branch carefully."); |
| 325 | +expect(command?.sourceFilePath).toContain( |
| 326 | +path.join(pluginRoot, "commands", "workflows-review.md"), |
330 | 327 | ); |
331 | | -expect( |
332 | | -commands.find((entry) => entry.skillName === "workflows:review")?.sourceFilePath, |
333 | | -).toContain(path.join(pluginRoot, "commands", "workflows-review.md")); |
334 | 328 | }); |
335 | 329 | }); |
336 | 330 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -49,6 +49,16 @@ let resolvePluginSkillDirs: typeof import("./plugin-skills.js").resolvePluginSki
|
49 | 49 | |
50 | 50 | const tempDirs = createTrackedTempDirs(); |
51 | 51 | |
| 52 | +async function expectPathMissing(targetPath: string): Promise<void> { |
| 53 | +try { |
| 54 | +await fs.lstat(targetPath); |
| 55 | +} catch (error) { |
| 56 | +expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); |
| 57 | +return; |
| 58 | +} |
| 59 | +throw new Error(`Expected path to be missing: ${targetPath}`); |
| 60 | +} |
| 61 | + |
52 | 62 | function buildRegistry(params: { acpxRoot: string; helperRoot: string }): PluginManifestRegistry { |
53 | 63 | return { |
54 | 64 | diagnostics: [], |
@@ -301,9 +311,7 @@ describe("resolvePluginSkillDirs", () => {
|
301 | 311 | }); |
302 | 312 | |
303 | 313 | expect(dirs).toStrictEqual([]); |
304 | | -await expect(fs.lstat(path.join(pluginSkillsDir, "stale-skill"))).rejects.toMatchObject({ |
305 | | -code: "ENOENT", |
306 | | -}); |
| 314 | +await expectPathMissing(path.join(pluginSkillsDir, "stale-skill")); |
307 | 315 | }); |
308 | 316 | |
309 | 317 | it("cleans up generated plugin skill links when no workspace is active", async () => { |
@@ -320,9 +328,7 @@ describe("resolvePluginSkillDirs", () => {
|
320 | 328 | }); |
321 | 329 | |
322 | 330 | expect(dirs).toStrictEqual([]); |
323 | | -await expect(fs.lstat(path.join(pluginSkillsDir, "stale-skill"))).rejects.toMatchObject({ |
324 | | -code: "ENOENT", |
325 | | -}); |
| 331 | +await expectPathMissing(path.join(pluginSkillsDir, "stale-skill")); |
326 | 332 | }); |
327 | 333 | |
328 | 334 | it("resolves Claude bundle command roots through the normal plugin skill path", async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。