refactor(skills-tests): share bundled diffs setup
This commit is contained in:
parent
8c8b0ab224
commit
e510132f3c
@ -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");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user