@@ -93,7 +93,6 @@ func TestNewClient(t *testing.T) {
9393 }
9494
9595 for _ , tc := range cases {
96-
9796 t .Run (tc .name , func (t * testing.T ) {
9897 t .Parallel ()
9998
@@ -389,7 +388,6 @@ func TestClient_Token(t *testing.T) {
389388 }
390389
391390 for _ , tc := range cases {
392-
393391 t .Run (tc .name , func (t * testing.T ) {
394392 t .Parallel ()
395393
@@ -513,7 +511,6 @@ func TestClient_RevokeToken(t *testing.T) {
513511 }
514512
515513 for _ , tc := range cases {
516-
517514 t .Run (tc .name , func (t * testing.T ) {
518515 t .Parallel ()
519516
@@ -564,13 +561,26 @@ func TestNewClient_WithProxy(t *testing.T) {
564561 client , err := NewClient (conf )
565562 assert .NilError (t , err )
566563
567- // checks that the Transport wrapped by the client with a AppsTransport handles Proxy properly
568564 appTransport , ok := client .installationsClient .Transport .(* ghinstallation.AppsTransport )
569- transport := appTransport .Client .(* http.Client ).Transport .(* http.Transport )
570- assert .Assert (t , ok )
565+ if ! ok {
566+ t .Fatalf ("Expected *ghinstallation.AppsTransport, got %T" , client .installationsClient .Transport )
567+ }
571568 assert .Assert (t , appTransport != nil )
572569
573- req , _ := http .NewRequest ("GET" , "http://example.com" , nil )
570+ httpClient , ok := appTransport .Client .(* http.Client )
571+ if ! ok {
572+ t .Fatalf ("Expected *http.Client, got %T" , appTransport .Client )
573+ }
574+
575+ // Safely assert that httpClient.Transport is of the correct type
576+ transport , ok := httpClient .Transport .(* http.Transport )
577+ if ! ok {
578+ t .Fatalf ("Expected *http.Transport, got %T" , httpClient .Transport )
579+ }
580+
581+ req , err := http .NewRequest ("GET" , "http://example.com" , nil )
582+ assert .NilError (t , err )
583+
574584 proxy , err := transport .Proxy (req )
575585 assert .NilError (t , err )
576586 assert .Equal (t , proxy .String (), proxyURL )
0 commit comments