Files
clawdbot/src/auto-reply/skill-commands.test.ts
2026-01-16 12:10:29 +00:00

26 lines
885 B
TypeScript

import { describe, expect, it } from "vitest";
import { resolveSkillCommandInvocation } from "./skill-commands.js";
describe("resolveSkillCommandInvocation", () => {
it("matches skill commands and parses args", () => {
const invocation = resolveSkillCommandInvocation({
commandBodyNormalized: "/demo_skill do the thing",
skillCommands: [
{ name: "demo_skill", skillName: "demo-skill", description: "Demo" },
],
});
expect(invocation?.command.skillName).toBe("demo-skill");
expect(invocation?.args).toBe("do the thing");
});
it("returns null for unknown commands", () => {
const invocation = resolveSkillCommandInvocation({
commandBodyNormalized: "/unknown arg",
skillCommands: [
{ name: "demo_skill", skillName: "demo-skill", description: "Demo" },
],
});
expect(invocation).toBeNull();
});
});