28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { mkdtempSync, rmSync, existsSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import { EMBEDDED_SKILL_FILES, getSkillContent, installSkillFiles } from "./embedded-skill.js";
|
|
|
|
describe("embedded-skill", () => {
|
|
test("embeds SKILL.md and reference files", () => {
|
|
expect(EMBEDDED_SKILL_FILES["SKILL.md"]).toBeDefined();
|
|
expect(EMBEDDED_SKILL_FILES["SKILL.md"]).toContain("name: seal-home");
|
|
expect(EMBEDDED_SKILL_FILES["references/cli.md"]).toBeDefined();
|
|
expect(getSkillContent()).toContain("name: seal-home");
|
|
});
|
|
|
|
test("installSkillFiles writes all embedded files to target directory", () => {
|
|
const tmp = mkdtempSync(join(tmpdir(), "skill-test-"));
|
|
try {
|
|
const res = installSkillFiles(tmp);
|
|
expect(res.targetDir).toBe(tmp);
|
|
expect(res.files.length).toBeGreaterThan(5);
|
|
expect(existsSync(join(tmp, "SKILL.md"))).toBe(true);
|
|
expect(existsSync(join(tmp, "references", "cli.md"))).toBe(true);
|
|
} finally {
|
|
rmSync(tmp, { recursive: true, force: true });
|
|
}
|
|
});
|
|
});
|