Skip to content

Commit 4f2b79b

Browse files
committed
add test
1 parent 65d7518 commit 4f2b79b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

utils/api/api_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,14 @@ func TestCallAndCheckSuccess(t *testing.T) {
110110
})
111111
assert.NoError(t, err)
112112
})
113+
114+
t.Run("api call successful, empty response", func(t *testing.T) {
115+
errMessage := "response error"
116+
parentCtx := context.Background()
117+
_, err := CallAndCheckSuccess(parentCtx, errMessage,
118+
func(ctx context.Context) (*struct{}, *_http.Response, error) {
119+
return &struct{}{}, &_http.Response{StatusCode: 200}, errors.New(errMessage)
120+
})
121+
assert.True(t, commonerrors.Any(err, commonerrors.ErrMarshalling))
122+
})
113123
}

0 commit comments

Comments
 (0)