feat: add user-invocable skill commands
This commit is contained in:
25
src/auto-reply/skill-commands.test.ts
Normal file
25
src/auto-reply/skill-commands.test.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user