The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | import { formatProviderSkillDisplayName, matchInlineSkills } from "./inlineSkills.ts"; |
| 3 | |
| 4 | describe("formatProviderSkillDisplayName", () => { |
| 5 | it.each([ |
| 6 | ["mca_lab_status", "mca_lab_status"], |
| 7 | ["frontend-design:frontend-design", "frontend-design:frontend-design"], |
| 8 | ["superpowers:brainstorming", "superpowers:brainstorming"], |
| 9 | ["DesignSync", "DesignSync"], |
| 10 | ])("shows %s as its skill name when the provider sets no display name", (name, label) => { |
| 11 | expect(formatProviderSkillDisplayName({ name })).toBe(label); |
| 12 | }); |
| 13 | |
| 14 | it("prefers the provider display name", () => { |
| 15 | expect(formatProviderSkillDisplayName({ name: "gh-fix-ci", displayName: " Fix CI " })).toBe( |
| 16 | "Fix CI", |
| 17 | ); |
| 18 | }); |
| 19 | }); |
| 20 | |
| 21 | describe("matchInlineSkills", () => { |
| 22 | it("preserves offsets, skill identity, first-name precedence, and unknown tokens", () => { |
| 23 | const first = { name: "design", displayName: "Design" }; |
| 24 | const duplicate = { name: "design", displayName: "Other design" }; |
| 25 | const namespaced = { name: "pdf:pdf" }; |
| 26 | const matches = [ |
| 27 | ...matchInlineSkills("Use $design then $missing and $pdf:pdf, $pdf:pdf $design", [ |
| 28 | first, |
| 29 | duplicate, |
| 30 | namespaced, |
| 31 | ]), |
| 32 | ]; |
| 33 | expect(matches).toEqual([ |
| 34 | { start: 4, end: 11, skill: first, rawText: "$design" }, |
| 35 | { start: 40, end: 48, skill: namespaced, rawText: "$pdf:pdf" }, |
| 36 | { start: 49, end: 56, skill: first, rawText: "$design" }, |
| 37 | ]); |
| 38 | expect(matches[0]?.skill).toBe(first); |
| 39 | expect(matches[1]?.skill).toBe(namespaced); |
| 40 | expect(matches[2]?.skill).toBe(first); |
| 41 | }); |
| 42 | }); |