(t *testing.T)
| 33 | } |
| 34 | |
| 35 | func TestParseScopeHeader(t *testing.T) { |
| 36 | tests := []struct { |
| 37 | name string |
| 38 | header string |
| 39 | expected []string |
| 40 | }{ |
| 41 | { |
| 42 | name: "empty header", |
| 43 | header: "", |
| 44 | expected: []string{}, |
| 45 | }, |
| 46 | { |
| 47 | name: "single scope", |
| 48 | header: "repo", |
| 49 | expected: []string{"repo"}, |
| 50 | }, |
| 51 | { |
| 52 | name: "multiple scopes", |
| 53 | header: "repo, user, gist", |
| 54 | expected: []string{"repo", "user", "gist"}, |
| 55 | }, |
| 56 | { |
| 57 | name: "scopes with extra whitespace", |
| 58 | header: " repo , user , gist ", |
| 59 | expected: []string{"repo", "user", "gist"}, |
| 60 | }, |
| 61 | { |
| 62 | name: "scopes without spaces", |
| 63 | header: "repo,user,gist", |
| 64 | expected: []string{"repo", "user", "gist"}, |
| 65 | }, |
| 66 | { |
| 67 | name: "scopes with colons", |
| 68 | header: "read:org, write:org, admin:org", |
| 69 | expected: []string{"read:org", "write:org", "admin:org"}, |
| 70 | }, |
| 71 | { |
| 72 | name: "empty parts are filtered", |
| 73 | header: "repo,,gist", |
| 74 | expected: []string{"repo", "gist"}, |
| 75 | }, |
| 76 | } |
| 77 | |
| 78 | for _, tt := range tests { |
| 79 | t.Run(tt.name, func(t *testing.T) { |
| 80 | result := ParseScopeHeader(tt.header) |
| 81 | assert.Equal(t, tt.expected, result) |
| 82 | }) |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | func TestFetcher_FetchTokenScopes(t *testing.T) { |
| 87 | tests := []struct { |
nothing calls this directly
no test coverage detected