From 17bf9e214f844c4389ac7a2922b15d968a6a2e3e Mon Sep 17 00:00:00 2001 From: edmarSoaress Date: Mon, 11 Mar 2024 15:08:00 -0300 Subject: [PATCH] adjust unit tests --- .testcoverage.yml | 1 - pkg/internal/requester/mock.go | 2 +- pkg/internal/requester/requester_test.go | 8 ++++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.testcoverage.yml b/.testcoverage.yml index e4251128..665129c5 100644 --- a/.testcoverage.yml +++ b/.testcoverage.yml @@ -8,5 +8,4 @@ exclude: paths: - ^pkg/internal - ^pkg/config - - ^pkg/cardtoken/mock.go - ^pkg/internal/requester/mock.go \ No newline at end of file diff --git a/pkg/internal/requester/mock.go b/pkg/internal/requester/mock.go index aea18aca..fb3aac68 100644 --- a/pkg/internal/requester/mock.go +++ b/pkg/internal/requester/mock.go @@ -31,7 +31,7 @@ func NewInvalidRequestMock() *http.Request { return req } -func NewRequestMockWithCancelledContext() *http.Request { +func NewRequestMockWithCanceledContext() *http.Request { ctx, cancel := context.WithTimeout(context.Background(), time.Second*1) defer cancel() diff --git a/pkg/internal/requester/requester_test.go b/pkg/internal/requester/requester_test.go index 0a5b8e9a..3c19892b 100644 --- a/pkg/internal/requester/requester_test.go +++ b/pkg/internal/requester/requester_test.go @@ -27,23 +27,23 @@ func TestDo(t *testing.T) { wantErr string }{ { - name: "should_return_reponse_ok_when_status_code_is_200", + name: "should_return_response_ok_when_status_code_is_200", args: args{ req: reqOK, }, wantStatus: "200 OK", }, { - name: "should_retry_and_return_reponse_erro_when_status_code_is_503", + name: "should_retry_and_return_response_error_when_status_code_is_503", args: args{ req: req, }, wantStatus: "503 Service Unavailable", }, { - name: "should_return_error_when_context_is_cancelled", + name: "should_return_error_when_context_is_canceled", args: args{ - req: NewRequestMockWithCancelledContext(), + req: NewRequestMockWithCanceledContext(), }, wantErr: "context canceled", },