MCPcopy Create free account
hub / github.com/cli/cli / TestMatchSkillPath

Function TestMatchSkillPath

internal/skills/discovery/discovery_test.go:1542–1566  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1540}
1541
1542func TestMatchSkillPath(t *testing.T) {
1543 tests := []struct {
1544 name string
1545 path string
1546 wantName string
1547 wantNamespace string
1548 }{
1549 {name: "skills convention", path: "skills/code-review/SKILL.md", wantName: "code-review", wantNamespace: ""},
1550 {name: "namespaced convention", path: "skills/monalisa/issue-triage/SKILL.md", wantName: "issue-triage", wantNamespace: "monalisa"},
1551 {name: "plugins convention", path: "plugins/hubot/skills/pr-summary/SKILL.md", wantName: "pr-summary", wantNamespace: "hubot"},
1552 {name: "non-skill file", path: "README.md", wantName: "", wantNamespace: ""},
1553 {name: "same name different namespace 1", path: "skills/kynan/commit/SKILL.md", wantName: "commit", wantNamespace: "kynan"},
1554 {name: "same name different namespace 2", path: "skills/will/commit/SKILL.md", wantName: "commit", wantNamespace: "will"},
1555 {name: "root convention", path: "my-skill/SKILL.md", wantName: "my-skill", wantNamespace: ""},
1556 {name: "nested skills convention", path: "terraform/code-generation/skills/terraform-style-guide/SKILL.md", wantName: "terraform-style-guide", wantNamespace: ""},
1557 {name: "nested namespaced convention", path: "terraform/code-generation/skills/hashicorp/terraform-style-guide/SKILL.md", wantName: "terraform-style-guide", wantNamespace: "hashicorp"},
1558 }
1559 for _, tt := range tests {
1560 t.Run(tt.name, func(t *testing.T) {
1561 name, namespace := MatchSkillPath(tt.path)
1562 assert.Equal(t, tt.wantName, name)
1563 assert.Equal(t, tt.wantNamespace, namespace)
1564 })
1565 }
1566}
1567
1568func TestIsSkillPath(t *testing.T) {
1569 tests := []struct {

Callers

nothing calls this directly

Calls 3

MatchSkillPathFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected