MCPcopy Index your code
hub / github.com/coder/coder / TestFormatResolvedSkillIndex

Function TestFormatResolvedSkillIndex

coderd/x/chatd/chattool/skill_test.go:38–124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36}
37
38func TestFormatResolvedSkillIndex(t *testing.T) {
39 t.Parallel()
40
41 t.Run("Empty", func(t *testing.T) {
42 t.Parallel()
43 assert.Empty(t, chattool.FormatResolvedSkillIndex(nil))
44 })
45
46 t.Run("PersonalOnly", func(t *testing.T) {
47 t.Parallel()
48
49 idx := chattool.FormatResolvedSkillIndex([]skillspkg.ResolvedSkill{{
50 Skill: skillspkg.Skill{
51 Name: "personal-review",
52 Description: "Personal review process",
53 Source: skillspkg.SourcePersonal,
54 },
55 Alias: "personal-review",
56 }})
57 assert.Contains(t, idx, "- personal-review: Personal review process")
58 assert.NotContains(t, idx, "read_skill_file")
59 assert.NotContains(t, idx, "qualified alias")
60 })
61
62 t.Run("WorkspaceOnlyMatchesLegacy", func(t *testing.T) {
63 t.Parallel()
64
65 resolved := []skillspkg.ResolvedSkill{{
66 Skill: skillspkg.Skill{
67 Name: "deep-review",
68 Description: "Review",
69 Source: skillspkg.SourceWorkspace,
70 },
71 Alias: "deep-review",
72 }}
73 assert.Equal(t,
74 "<available-skills>\n"+
75 "Use read_skill to load a skill's full instructions before following them.\n"+
76 "Use read_skill_file to read supporting files referenced by a workspace skill.\n"+
77 "\n"+
78 "- deep-review: Review\n"+
79 "</available-skills>",
80 chattool.FormatResolvedSkillIndex(resolved),
81 )
82 })
83
84 t.Run("MixedNonColliding", func(t *testing.T) {
85 t.Parallel()
86
87 idx := chattool.FormatResolvedSkillIndex([]skillspkg.ResolvedSkill{
88 {
89 Skill: skillspkg.Skill{
90 Name: "personal-review",
91 Description: "Personal review process",
92 Source: skillspkg.SourcePersonal,
93 },
94 Alias: "personal-review",
95 },

Callers

nothing calls this directly

Calls 5

FormatResolvedSkillIndexFunction · 0.92
RunMethod · 0.65
EmptyMethod · 0.45
ContainsMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected