@@ -76,13 +76,13 @@ func TestCheckAPICallSuccess(t *testing.T) {
7676 })
7777}
7878
79- func TestFetchAndCheckSuccess (t * testing.T ) {
79+ func TestCallAndCheckSuccess (t * testing.T ) {
8080 t .Run ("context cancelled" , func (t * testing.T ) {
8181 errMessage := "context cancelled"
8282 parentCtx := context .Background ()
8383 ctx , cancelCtx := context .WithCancel (parentCtx )
8484 cancelCtx ()
85- _ , actualErr := FetchAndCheckSuccess (ctx , errMessage ,
85+ _ , actualErr := CallAndCheckSuccess (ctx , errMessage ,
8686 func (ctx context.Context ) (* struct {}, * _http.Response , error ) {
8787 return nil , & _http.Response {Body : io .NopCloser (bytes .NewReader (nil ))}, errors .New (errMessage )
8888 })
@@ -92,7 +92,7 @@ func TestFetchAndCheckSuccess(t *testing.T) {
9292 t .Run ("api call not successful" , func (t * testing.T ) {
9393 errMessage := "client error"
9494 parentCtx := context .Background ()
95- _ , actualErr := FetchAndCheckSuccess (parentCtx , errMessage ,
95+ _ , actualErr := CallAndCheckSuccess (parentCtx , errMessage ,
9696 func (ctx context.Context ) (* struct {}, * _http.Response , error ) {
9797 resp := _http.Response {StatusCode : 400 , Body : io .NopCloser (bytes .NewReader ([]byte ("{\" message\" : \" client error\" ,\" requestId\" : \" 761761721\" }" )))}
9898 return nil , & resp , errors .New (errMessage )
@@ -104,7 +104,7 @@ func TestFetchAndCheckSuccess(t *testing.T) {
104104 t .Run ("no context error, api call successful" , func (t * testing.T ) {
105105 errMessage := "no error"
106106 parentCtx := context .Background ()
107- _ , err := FetchAndCheckSuccess (parentCtx , errMessage ,
107+ _ , err := CallAndCheckSuccess (parentCtx , errMessage ,
108108 func (ctx context.Context ) (* struct {}, * _http.Response , error ) {
109109 return nil , & _http.Response {StatusCode : 200 }, errors .New (errMessage )
110110 })
0 commit comments