mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-21 13:44:03 +00:00
test: centralize canonical skill fixtures
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
hasBinaryMock,
|
||||
runCommandWithTimeoutMock,
|
||||
} from "./skills-install.test-mocks.js";
|
||||
import { createCanonicalFixtureSkill } from "./skills.test-helpers.js";
|
||||
import { resolveSkillToolsRootDir } from "./skills/tools-dir.js";
|
||||
import type { SkillEntry, SkillInstallSpec } from "./skills/types.js";
|
||||
|
||||
@@ -74,14 +75,7 @@ function createFixtureSkill(params: {
|
||||
baseDir: string;
|
||||
source: string;
|
||||
}): SkillEntry["skill"] {
|
||||
return {
|
||||
name: params.name,
|
||||
description: params.description,
|
||||
filePath: params.filePath,
|
||||
baseDir: params.baseDir,
|
||||
source: params.source,
|
||||
disableModelInvocation: false,
|
||||
};
|
||||
return createCanonicalFixtureSkill(params);
|
||||
}
|
||||
|
||||
function buildDownloadSpec(params: {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildWorkspaceSkillStatus } from "./skills-status.js";
|
||||
import { createCanonicalFixtureSkill } from "./skills.test-helpers.js";
|
||||
import type { SkillEntry } from "./skills/types.js";
|
||||
|
||||
describe("buildWorkspaceSkillStatus", () => {
|
||||
@@ -48,12 +49,5 @@ function createFixtureSkill(params: {
|
||||
baseDir: string;
|
||||
source: string;
|
||||
}): SkillEntry["skill"] {
|
||||
return {
|
||||
name: params.name,
|
||||
description: params.description,
|
||||
filePath: params.filePath,
|
||||
baseDir: params.baseDir,
|
||||
source: params.source,
|
||||
disableModelInvocation: false,
|
||||
};
|
||||
return createCanonicalFixtureSkill(params);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { afterEach, describe, expect, it } from "vitest";
|
||||
import { withEnv, withEnvAsync } from "../test-utils/env.js";
|
||||
import { buildWorkspaceSkillStatus } from "./skills-status.js";
|
||||
import { writeSkill } from "./skills.e2e-test-helpers.js";
|
||||
import { createCanonicalFixtureSkill } from "./skills.test-helpers.js";
|
||||
import type { SkillEntry } from "./skills/types.js";
|
||||
|
||||
const tempDirs: string[] = [];
|
||||
@@ -57,14 +58,7 @@ function createFixtureSkill(params: {
|
||||
baseDir: string;
|
||||
source: string;
|
||||
}): SkillEntry["skill"] {
|
||||
return {
|
||||
name: params.name,
|
||||
description: params.description,
|
||||
filePath: params.filePath,
|
||||
baseDir: params.baseDir,
|
||||
source: params.source,
|
||||
disableModelInvocation: false,
|
||||
};
|
||||
return createCanonicalFixtureSkill(params);
|
||||
}
|
||||
|
||||
describe("buildWorkspaceSkillStatus", () => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveSkillsPromptForRun } from "./skills.js";
|
||||
import { createCanonicalFixtureSkill } from "./skills.test-helpers.js";
|
||||
import type { SkillEntry } from "./skills/types.js";
|
||||
|
||||
describe("resolveSkillsPromptForRun", () => {
|
||||
@@ -37,12 +38,5 @@ function createFixtureSkill(params: {
|
||||
baseDir: string;
|
||||
source: string;
|
||||
}): SkillEntry["skill"] {
|
||||
return {
|
||||
name: params.name,
|
||||
description: params.description,
|
||||
filePath: params.filePath,
|
||||
baseDir: params.baseDir,
|
||||
source: params.source,
|
||||
disableModelInvocation: false,
|
||||
};
|
||||
return createCanonicalFixtureSkill(params);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { createSyntheticSourceInfo, type Skill } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
export async function writeSkill(params: {
|
||||
dir: string;
|
||||
@@ -21,3 +22,25 @@ ${body ?? `# ${name}\n`}
|
||||
"utf-8",
|
||||
);
|
||||
}
|
||||
|
||||
export function createCanonicalFixtureSkill(params: {
|
||||
name: string;
|
||||
description: string;
|
||||
filePath: string;
|
||||
baseDir: string;
|
||||
source: string;
|
||||
disableModelInvocation?: boolean;
|
||||
}): Skill {
|
||||
// Keep skill fixtures on the upstream canonical provenance shape.
|
||||
return {
|
||||
name: params.name,
|
||||
description: params.description,
|
||||
filePath: params.filePath,
|
||||
baseDir: params.baseDir,
|
||||
sourceInfo: createSyntheticSourceInfo(params.filePath, {
|
||||
source: params.source,
|
||||
baseDir: params.baseDir,
|
||||
}),
|
||||
disableModelInvocation: params.disableModelInvocation ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import path from "node:path";
|
||||
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||
import { buildWorkspaceSkillStatus } from "../agents/skills-status.js";
|
||||
import type { SkillEntry } from "../agents/skills.js";
|
||||
import { createCanonicalFixtureSkill } from "../agents/skills.test-helpers.js";
|
||||
import { captureEnv } from "../test-utils/env.js";
|
||||
import { formatSkillInfo, formatSkillsCheck, formatSkillsList } from "./skills-cli.format.js";
|
||||
|
||||
@@ -92,12 +93,5 @@ function createFixtureSkill(params: {
|
||||
baseDir: string;
|
||||
source: string;
|
||||
}): SkillEntry["skill"] {
|
||||
return {
|
||||
name: params.name,
|
||||
description: params.description,
|
||||
filePath: params.filePath,
|
||||
baseDir: params.baseDir,
|
||||
source: params.source,
|
||||
disableModelInvocation: false,
|
||||
};
|
||||
return createCanonicalFixtureSkill(params);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user