MCPcopy Create free account
hub / github.com/JordanCoin/codemap / TestNewIndex

Function TestNewIndex

skills/loader_test.go:139–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

137}
138
139func TestNewIndex(t *testing.T) {
140 skills := []Skill{
141 {Meta: SkillMeta{Name: "a", Keywords: []string{"refactor"}, Languages: []string{"go"}}},
142 {Meta: SkillMeta{Name: "b", Keywords: []string{"refactor", "test"}, Languages: []string{"go", "python"}}},
143 }
144
145 idx := newIndex(skills)
146 if len(idx.ByName) != 2 {
147 t.Errorf("expected 2 names, got %d", len(idx.ByName))
148 }
149 if len(idx.ByKeyword["refactor"]) != 2 {
150 t.Errorf("expected 2 skills for 'refactor', got %d", len(idx.ByKeyword["refactor"]))
151 }
152 if len(idx.ByLanguage["go"]) != 2 {
153 t.Errorf("expected 2 skills for 'go', got %d", len(idx.ByLanguage["go"]))
154 }
155 if len(idx.ByLanguage["python"]) != 1 {
156 t.Errorf("expected 1 skill for 'python', got %d", len(idx.ByLanguage["python"]))
157 }
158}
159
160func TestMatchSkills_ByCategory(t *testing.T) {
161 skills := []Skill{

Callers

nothing calls this directly

Calls 1

newIndexFunction · 0.85

Tested by

no test coverage detected