(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestFindNameCollisions(t *testing.T) { |
| 10 | tests := []struct { |
| 11 | name string |
| 12 | skills []Skill |
| 13 | want []NameCollision |
| 14 | }{ |
| 15 | { |
| 16 | name: "no collisions", |
| 17 | skills: []Skill{ |
| 18 | {Name: "code-review", Path: "skills/code-review"}, |
| 19 | {Name: "issue-triage", Path: "skills/issue-triage"}, |
| 20 | }, |
| 21 | want: nil, |
| 22 | }, |
| 23 | { |
| 24 | name: "single collision with different conventions", |
| 25 | skills: []Skill{ |
| 26 | {Name: "pr-summary", Path: "skills/pr-summary"}, |
| 27 | {Name: "pr-summary", Path: "plugins/hubot/skills/pr-summary", Convention: "plugins"}, |
| 28 | }, |
| 29 | want: []NameCollision{ |
| 30 | {Name: "pr-summary", DisplayNames: []string{"pr-summary", "[plugins] pr-summary"}}, |
| 31 | }, |
| 32 | }, |
| 33 | { |
| 34 | name: "collisions sorted by name", |
| 35 | skills: []Skill{ |
| 36 | {Name: "octocat-lint", Path: "skills/octocat-lint"}, |
| 37 | {Name: "octocat-lint", Path: "skills/hubot/octocat-lint"}, |
| 38 | {Name: "code-review", Path: "skills/code-review"}, |
| 39 | {Name: "code-review", Path: "skills/monalisa/code-review"}, |
| 40 | }, |
| 41 | want: []NameCollision{ |
| 42 | {Name: "code-review", DisplayNames: []string{"code-review", "code-review"}}, |
| 43 | {Name: "octocat-lint", DisplayNames: []string{"octocat-lint", "octocat-lint"}}, |
| 44 | }, |
| 45 | }, |
| 46 | } |
| 47 | for _, tt := range tests { |
| 48 | t.Run(tt.name, func(t *testing.T) { |
| 49 | got := FindNameCollisions(tt.skills) |
| 50 | assert.Equal(t, tt.want, got) |
| 51 | }) |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | func TestFormatCollisions(t *testing.T) { |
| 56 | tests := []struct { |
nothing calls this directly
no test coverage detected