From 811ef693f85e561c399908cedaa118ddbdead3ca Mon Sep 17 00:00:00 2001 From: cukhoaimon Date: Wed, 28 Feb 2024 21:12:10 +0700 Subject: [PATCH] feat: run make mock and rename TransferTxAccount to TransferTx --- internal/delivery/http/mock/store.go | 12 ++++++------ internal/usecase/sqlc/store_test.go | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/delivery/http/mock/store.go b/internal/delivery/http/mock/store.go index 088adb2..9cac5c1 100644 --- a/internal/delivery/http/mock/store.go +++ b/internal/delivery/http/mock/store.go @@ -290,19 +290,19 @@ func (mr *MockStoreMockRecorder) ListTransfers(arg0, arg1 interface{}) *gomock.C return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTransfers", reflect.TypeOf((*MockStore)(nil).ListTransfers), arg0, arg1) } -// TransferTxAccount mocks base method. -func (m *MockStore) TransferTxAccount(arg0 context.Context, arg1 usecase.TransferTxParams) (usecase.TransferTxResult, error) { +// TransferTx mocks base method. +func (m *MockStore) TransferTx(arg0 context.Context, arg1 usecase.TransferTxParams) (usecase.TransferTxResult, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransferTxAccount", arg0, arg1) + ret := m.ctrl.Call(m, "TransferTx", arg0, arg1) ret0, _ := ret[0].(usecase.TransferTxResult) ret1, _ := ret[1].(error) return ret0, ret1 } -// TransferTxAccount indicates an expected call of TransferTxAccount. -func (mr *MockStoreMockRecorder) TransferTxAccount(arg0, arg1 interface{}) *gomock.Call { +// TransferTx indicates an expected call of TransferTx. +func (mr *MockStoreMockRecorder) TransferTx(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransferTxAccount", reflect.TypeOf((*MockStore)(nil).TransferTxAccount), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransferTx", reflect.TypeOf((*MockStore)(nil).TransferTx), arg0, arg1) } // UpdateAccount mocks base method. diff --git a/internal/usecase/sqlc/store_test.go b/internal/usecase/sqlc/store_test.go index ae784a7..f788706 100644 --- a/internal/usecase/sqlc/store_test.go +++ b/internal/usecase/sqlc/store_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestStore_TransferTxAccount(t *testing.T) { +func TestStore_TransferTx(t *testing.T) { store := NewStore(testDB) wantFromAccount := createRandomAccount(t) @@ -21,7 +21,7 @@ func TestStore_TransferTxAccount(t *testing.T) { for i := 0; i < n; i++ { go func() { - result, err := store.TransferTxAccount(context.Background(), TransferTxParams{ + result, err := store.TransferTx(context.Background(), TransferTxParams{ FromAccountID: wantFromAccount.ID, ToAccountID: wantToAccount.ID, Amount: amount, @@ -115,7 +115,7 @@ func TestStore_TransferTxAccount(t *testing.T) { require.Equal(t, wantToAccount.Balance+int64(n)*amount, updatedAccount2.Balance) } -func TestStore_TransferTxAccountDeadLock(t *testing.T) { +func TestStore_TransferTxDeadLock(t *testing.T) { store := NewStore(testDB) wantFromAccount := createRandomAccount(t) @@ -135,7 +135,7 @@ func TestStore_TransferTxAccountDeadLock(t *testing.T) { } go func() { - _, err := store.TransferTxAccount(context.Background(), TransferTxParams{ + _, err := store.TransferTx(context.Background(), TransferTxParams{ FromAccountID: fromAccountID, ToAccountID: toAccountID, Amount: amount,