(t *testing.T)
| 129 | } |
| 130 | |
| 131 | func TestTokenHasUserCapability(t *testing.T) { |
| 132 | tests := []struct { |
| 133 | token string |
| 134 | want bool |
| 135 | }{ |
| 136 | {token: "ghp_token", want: true}, |
| 137 | {token: "gho_token", want: true}, |
| 138 | {token: "github_pat_token", want: true}, |
| 139 | {token: "ghu_token", want: true}, |
| 140 | {token: "ghs_token", want: false}, |
| 141 | } |
| 142 | |
| 143 | for _, tt := range tests { |
| 144 | t.Run(tt.token[:4], func(t *testing.T) { |
| 145 | got, err := tokenHasUserCapability(tt.token) |
| 146 | require.NoError(t, err) |
| 147 | assert.Equal(t, tt.want, got) |
| 148 | }) |
| 149 | } |
| 150 | |
| 151 | _, err := tokenHasUserCapability("unsupported") |
| 152 | assert.EqualError(t, err, "GH_ACCEPTANCE_TOKEN has an unsupported token prefix") |
| 153 | } |
| 154 | |
| 155 | func TestAcceptanceScriptsDeclareUserCapabilityRequirement(t *testing.T) { |
| 156 | files, err := filepath.Glob(filepath.Join("testdata", "*", "*.txtar")) |
nothing calls this directly
no test coverage detected