From 57ee409f96297298397bbbfbd3228ea9b3fa9b6a Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Thu, 26 Jun 2025 09:54:19 +0300 Subject: [PATCH] add UpdateAlias to the DevAccountService and mocks --- dev/api.go | 7 +++++++ testutil/mocks/api_mock.go | 4 ++++ testutil/mocks/service_mock.go | 5 +++++ testutil/testservice/account_service.go | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/dev/api.go b/dev/api.go index 26e1e4c..6000896 100644 --- a/dev/api.go +++ b/dev/api.go @@ -806,6 +806,13 @@ func (das *DevAccountService) RequestAlias(ctx context.Context, publicKey string }, nil } +func (das *DevAccountService) UpdateAlias(ctx context.Context, publicKey string, name string) (*models.RequestAliasResult, error) { + logg.DebugCtxf(ctx, "Updated the alias", "address", publicKey, "name", name) + return &models.RequestAliasResult{ + Alias: name, + }, nil +} + func (das *DevAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) { logg.DebugCtxf(ctx, "sent an SMS", "inviterPhone", inviterPhone, "inviteePhone", inviteePhone) return &models.SendSMSResponse{ diff --git a/testutil/mocks/api_mock.go b/testutil/mocks/api_mock.go index 2293aa6..c2f8e39 100644 --- a/testutil/mocks/api_mock.go +++ b/testutil/mocks/api_mock.go @@ -58,6 +58,10 @@ func (m MockApi) RequestAlias(ctx context.Context, publicKey string, hint string return nil, nil } +func (m MockApi) UpdateAlias(ctx context.Context, publicKey string, name string) (*models.RequestAliasResult, error) { + return nil, nil +} + func (m MockApi) TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error) { return nil, nil } diff --git a/testutil/mocks/service_mock.go b/testutil/mocks/service_mock.go index 93d0358..09ab50b 100644 --- a/testutil/mocks/service_mock.go +++ b/testutil/mocks/service_mock.go @@ -58,6 +58,11 @@ func (m *MockAccountService) RequestAlias(ctx context.Context, publicKey string, return args.Get(0).(*models.RequestAliasResult), args.Error(1) } +func (m *MockAccountService) UpdateAlias(ctx context.Context, publicKey string, name string) (*models.RequestAliasResult, error) { + args := m.Called(publicKey, name) + return args.Get(0).(*models.RequestAliasResult), args.Error(1) +} + func (m *MockAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) { args := m.Called(inviterPhone, inviteePhone) return args.Get(0).(*models.SendSMSResponse), args.Error(1) diff --git a/testutil/testservice/account_service.go b/testutil/testservice/account_service.go index 935df73..4294b6b 100644 --- a/testutil/testservice/account_service.go +++ b/testutil/testservice/account_service.go @@ -69,6 +69,10 @@ func (m *TestAccountService) RequestAlias(ctx context.Context, publicKey string, return &models.RequestAliasResult{}, nil } +func (m *TestAccountService) UpdateAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) { + return &models.RequestAliasResult{}, nil +} + func (m *TestAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) { return &models.SendSMSResponse{}, nil }