(t *testing.T)
| 15 | } |
| 16 | |
| 17 | func TestIsOfficial(t *testing.T) { |
| 18 | tests := []struct { |
| 19 | name string |
| 20 | extName string |
| 21 | extOwner string |
| 22 | want bool |
| 23 | }{ |
| 24 | { |
| 25 | name: "known official extension matches", |
| 26 | extName: "stack", |
| 27 | extOwner: "github", |
| 28 | want: true, |
| 29 | }, |
| 30 | { |
| 31 | name: "official name with different owner is not official", |
| 32 | extName: "stack", |
| 33 | extOwner: "williammartin", |
| 34 | want: false, |
| 35 | }, |
| 36 | { |
| 37 | name: "official name with empty owner is not official", |
| 38 | extName: "stack", |
| 39 | extOwner: "", |
| 40 | want: false, |
| 41 | }, |
| 42 | { |
| 43 | name: "owner comparison is case-insensitive", |
| 44 | extName: "stack", |
| 45 | extOwner: "GitHub", |
| 46 | want: true, |
| 47 | }, |
| 48 | { |
| 49 | name: "mixed-case name does not match", |
| 50 | extName: "STACK", |
| 51 | extOwner: "github", |
| 52 | want: false, |
| 53 | }, |
| 54 | { |
| 55 | name: "unknown name is not official", |
| 56 | extName: "not-a-real-extension", |
| 57 | extOwner: "github", |
| 58 | want: false, |
| 59 | }, |
| 60 | { |
| 61 | name: "empty name is not official", |
| 62 | extName: "", |
| 63 | extOwner: "github", |
| 64 | want: false, |
| 65 | }, |
| 66 | } |
| 67 | |
| 68 | for _, tt := range tests { |
| 69 | t.Run(tt.name, func(t *testing.T) { |
| 70 | assert.Equal(t, tt.want, IsOfficial(tt.extName, tt.extOwner)) |
| 71 | }) |
| 72 | } |
| 73 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…