@@ -164,10 +164,8 @@ func TestFetcher_FetchTokenScopes(t *testing.T) {
164164 t .Run (tt .name , func (t * testing.T ) {
165165 server := httptest .NewServer (tt .handler )
166166 defer server .Close ()
167-
168- fetcher := NewFetcher (FetcherOptions {
169- APIHost : testAPIHostResolver {baseURL : server .URL },
170- })
167+ apiHost := testAPIHostResolver {baseURL : server .URL }
168+ fetcher := NewFetcher (apiHost , FetcherOptions {})
171169
172170 scopes , err := fetcher .FetchTokenScopes (context .Background (), "test-token" )
173171
@@ -185,12 +183,13 @@ func TestFetcher_FetchTokenScopes(t *testing.T) {
185183}
186184
187185func TestFetcher_DefaultOptions (t * testing.T ) {
188- fetcher := NewFetcher (FetcherOptions {})
186+ apiHost := testAPIHostResolver {baseURL : "https://api.github.com" }
187+ fetcher := NewFetcher (apiHost , FetcherOptions {})
189188
190189 // Verify default API host is set
191190 apiURL , err := fetcher .apiHost .BaseRESTURL (context .Background ())
192191 require .NoError (t , err )
193- assert .Equal (t , "https://api.github.com/ " , apiURL .String ())
192+ assert .Equal (t , "https://api.github.com" , apiURL .String ())
194193
195194 // Verify default HTTP client is set with timeout
196195 assert .NotNil (t , fetcher .client )
@@ -200,17 +199,17 @@ func TestFetcher_DefaultOptions(t *testing.T) {
200199func TestFetcher_CustomHTTPClient (t * testing.T ) {
201200 customClient := & http.Client {Timeout : 5 * time .Second }
202201
203- fetcher := NewFetcher (FetcherOptions {
202+ apiHost := testAPIHostResolver {baseURL : "https://api.github.com" }
203+ fetcher := NewFetcher (apiHost , FetcherOptions {
204204 HTTPClient : customClient ,
205205 })
206206
207207 assert .Equal (t , customClient , fetcher .client )
208208}
209209
210210func TestFetcher_CustomAPIHost (t * testing.T ) {
211- fetcher := NewFetcher (FetcherOptions {
212- APIHost : testAPIHostResolver {baseURL : "https://api.github.enterprise.com" },
213- })
211+ apiHost := testAPIHostResolver {baseURL : "https://api.github.enterprise.com" }
212+ fetcher := NewFetcher (apiHost , FetcherOptions {})
214213
215214 apiURL , err := fetcher .apiHost .BaseRESTURL (context .Background ())
216215 require .NoError (t , err )
@@ -224,9 +223,8 @@ func TestFetcher_ContextCancellation(t *testing.T) {
224223 }))
225224 defer server .Close ()
226225
227- fetcher := NewFetcher (FetcherOptions {
228- APIHost : testAPIHostResolver {baseURL : server .URL },
229- })
226+ apiHost := testAPIHostResolver {baseURL : server .URL }
227+ fetcher := NewFetcher (apiHost , FetcherOptions {})
230228
231229 ctx , cancel := context .WithCancel (context .Background ())
232230 cancel () // Cancel immediately
0 commit comments