@@ -29,6 +29,7 @@ func TestGHGet_BuildsCorrectURL(t *testing.T) {
2929
3030 resp , err := handler .ghGet (context .Background (), "/repos/test/repo/actions/runs" )
3131 require .NoError (t , err )
32+ require .NotNil (t , resp )
3233 assert .Equal (t , http .StatusOK , resp .StatusCode )
3334}
3435
@@ -49,6 +50,7 @@ func TestGHGet_HandlesFullURL(t *testing.T) {
4950
5051 resp , err := handler .ghGet (context .Background (), "https://api.github.com/repos/test/repo" )
5152 require .NoError (t , err )
53+ require .NotNil (t , resp )
5254 assert .Equal (t , http .StatusOK , resp .StatusCode )
5355}
5456
@@ -68,9 +70,7 @@ func TestGHGetWithRetry_SuccessFirstAttempt(t *testing.T) {
6870
6971 resp , err := handler .ghGetWithRetry (context .Background (), "/test" )
7072 require .NoError (t , err )
71- if resp == nil {
72- t .Fatal ("expected non-nil response" )
73- }
73+ require .NotNil (t , resp )
7474 assert .Equal (t , http .StatusOK , resp .StatusCode )
7575}
7676
@@ -99,6 +99,7 @@ func TestGHGetWithRetry_RateLimitRetry(t *testing.T) {
9999
100100 resp , err := handler .ghGetWithRetry (context .Background (), "/test" )
101101 require .NoError (t , err )
102+ require .NotNil (t , resp )
102103 assert .Equal (t , http .StatusOK , resp .StatusCode )
103104 assert .Equal (t , 2 , attemptCount , "should retry after rate limit" )
104105}
@@ -121,6 +122,7 @@ func TestGHGetWithRetry_MaxAttemptsExceeded(t *testing.T) {
121122
122123 resp , err := handler .ghGetWithRetry (context .Background (), "/test" )
123124 require .NoError (t , err ) // Function returns the response, not an error
125+ require .NotNil (t , resp )
124126 assert .Equal (t , http .StatusForbidden , resp .StatusCode )
125127 // Should have attempted the maximum number of times
126128 assert .True (t , attemptCount >= 1 , "should make at least one attempt" )
@@ -156,6 +158,7 @@ func TestGHGetWithRetry_RespectsRetryAfterHeader(t *testing.T) {
156158 elapsed := time .Since (start )
157159
158160 require .NoError (t , err )
161+ require .NotNil (t , resp )
159162 assert .Equal (t , http .StatusOK , resp .StatusCode )
160163 // Should have waited at least 1 second due to Retry-After header
161164 assert .True (t , elapsed >= time .Second , "should respect Retry-After header" )
0 commit comments