(t *testing.T)
| 220 | } |
| 221 | |
| 222 | func TestFetcher_ContextCancellation(t *testing.T) { |
| 223 | server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
| 224 | time.Sleep(100 * time.Millisecond) |
| 225 | w.WriteHeader(http.StatusOK) |
| 226 | })) |
| 227 | defer server.Close() |
| 228 | |
| 229 | apiHost := testAPIHostResolver{baseURL: server.URL} |
| 230 | fetcher := NewFetcher(apiHost, FetcherOptions{}) |
| 231 | |
| 232 | ctx, cancel := context.WithCancel(context.Background()) |
| 233 | cancel() // Cancel immediately |
| 234 | |
| 235 | _, err := fetcher.FetchTokenScopes(ctx, "test-token") |
| 236 | require.Error(t, err) |
| 237 | } |
nothing calls this directly
no test coverage detected