From e510132f3c965e0d939c438b4e8513dd0a634e91 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 17 Mar 2026 07:54:33 +0000 Subject: [PATCH] refactor(skills-tests): share bundled diffs setup --- .../skills-runtime.integration.test.ts | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/agents/pi-embedded-runner/skills-runtime.integration.test.ts b/src/agents/pi-embedded-runner/skills-runtime.integration.test.ts index 8d42b061b81..437b021cdd7 100644 --- a/src/agents/pi-embedded-runner/skills-runtime.integration.test.ts +++ b/src/agents/pi-embedded-runner/skills-runtime.integration.test.ts @@ -31,6 +31,14 @@ async function setupBundledDiffsPlugin() { return { bundledPluginsDir, workspaceDir }; } +async function resolveBundledDiffsSkillEntries(config?: OpenClawConfig) { + const { bundledPluginsDir, workspaceDir } = await setupBundledDiffsPlugin(); + process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = bundledPluginsDir; + clearPluginManifestRegistryCache(); + + return resolveEmbeddedRunSkillEntries({ workspaceDir, ...(config ? { config } : {}) }); +} + afterEach(async () => { process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = originalBundledDir; clearPluginManifestRegistryCache(); @@ -41,10 +49,6 @@ afterEach(async () => { describe("resolveEmbeddedRunSkillEntries (integration)", () => { it("loads bundled diffs skill when explicitly enabled in config", async () => { - const { bundledPluginsDir, workspaceDir } = await setupBundledDiffsPlugin(); - process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = bundledPluginsDir; - clearPluginManifestRegistryCache(); - const config: OpenClawConfig = { plugins: { entries: { @@ -53,23 +57,14 @@ describe("resolveEmbeddedRunSkillEntries (integration)", () => { }, }; - const result = resolveEmbeddedRunSkillEntries({ - workspaceDir, - config, - }); + const result = await resolveBundledDiffsSkillEntries(config); expect(result.shouldLoadSkillEntries).toBe(true); expect(result.skillEntries.map((entry) => entry.skill.name)).toContain("diffs"); }); it("skips bundled diffs skill when config is missing", async () => { - const { bundledPluginsDir, workspaceDir } = await setupBundledDiffsPlugin(); - process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = bundledPluginsDir; - clearPluginManifestRegistryCache(); - - const result = resolveEmbeddedRunSkillEntries({ - workspaceDir, - }); + const result = await resolveBundledDiffsSkillEntries(); expect(result.shouldLoadSkillEntries).toBe(true); expect(result.skillEntries.map((entry) => entry.skill.name)).not.toContain("diffs");