From d74a4cc33ba5fb1c04f2a6b1a03062ea1f8cc0e7 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 24 Oct 2024 10:10:03 +0300 Subject: [PATCH] update service mock method signatures --- internal/mocks/servicemock.go | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/internal/mocks/servicemock.go b/internal/mocks/servicemock.go index 0cf07c6..0b56314 100644 --- a/internal/mocks/servicemock.go +++ b/internal/mocks/servicemock.go @@ -11,19 +11,9 @@ type MockAccountService struct { mock.Mock } -func (m *MockAccountService) CreateAccount() (*api.OKResponse, *api.ErrResponse) { +func (m *MockAccountService) CreateAccount() (*api.OKResponse, error) { args := m.Called() - okResponse, ok := args.Get(0).(*api.OKResponse) - errResponse, err := args.Get(1).(*api.ErrResponse) - - if ok { - return okResponse, nil - } - - if err { - return nil, errResponse - } - return nil, nil + return args.Get(0).(*api.OKResponse), args.Error(1) } func (m *MockAccountService) CheckBalance(publicKey string) (*models.BalanceResponse, error) { @@ -36,15 +26,7 @@ func (m *MockAccountService) CheckAccountStatus(trackingId string) (*models.Trac return args.Get(0).(*models.TrackStatusResponse), args.Error(1) } -func (m *MockAccountService) TrackAccountStatus(publicKey string) (*api.OKResponse, *api.ErrResponse) { +func (m *MockAccountService) TrackAccountStatus(publicKey string) (*api.OKResponse, error) { args := m.Called(publicKey) - okResponse, ok := args.Get(0).(*api.OKResponse) - errResponse, err := args.Get(1).(*api.ErrResponse) - if ok { - return okResponse, nil - } - if err { - return nil, errResponse - } - return nil, nil + return args.Get(0).(*api.OKResponse), args.Error(1) }