From 195f003d69016ad65e62a23d78d4a632cca9ba5a Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 29 Aug 2024 19:53:55 +0300 Subject: [PATCH] create mocks --- internal/handlers/ussd/mocks/mocks.go | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 internal/handlers/ussd/mocks/mocks.go diff --git a/internal/handlers/ussd/mocks/mocks.go b/internal/handlers/ussd/mocks/mocks.go new file mode 100644 index 0000000..3c7eb1e --- /dev/null +++ b/internal/handlers/ussd/mocks/mocks.go @@ -0,0 +1,44 @@ +package mocks + +import ( + "git.grassecon.net/urdt/ussd/internal/models" + "github.com/stretchr/testify/mock" +) + +type MockAccountFileHandler struct { + mock.Mock +} + +func (m *MockAccountFileHandler) EnsureFileExists() error { + args := m.Called() + return args.Error(0) +} + +func (m *MockAccountFileHandler) ReadAccountData() (map[string]string, error) { + args := m.Called() + return args.Get(0).(map[string]string), args.Error(1) +} + +func (m *MockAccountFileHandler) WriteAccountData(data map[string]string) error { + args := m.Called(data) + return args.Error(0) +} + +type MockAccountService struct { + mock.Mock +} + +func (m *MockAccountService) CreateAccount() (*models.AccountResponse, error) { + args := m.Called() + return args.Get(0).(*models.AccountResponse), args.Error(1) +} + +func (m *MockAccountService) CheckAccountStatus(TrackingId string) (string, error) { + args := m.Called() + return args.Get(0).(string), args.Error(1) +} + +func (m *MockAccountService) CheckBalance(PublicKey string) (string, error) { + args := m.Called() + return args.Get(0).(string), args.Error(1) +}