Skip to content

Commit

Permalink
fatal: fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cukhoaimon committed Feb 28, 2024
1 parent 811ef69 commit df3b81c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion internal/delivery/http/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (handler *Handler) createTransfer(ctx *gin.Context) {
Amount: req.Amount,
}

account, err := handler.Store.TransferTxAccount(ctx, arg)
account, err := handler.Store.TransferTx(ctx, arg)
if err != nil {
ctx.JSON(http.StatusInternalServerError, errorResponse(err))
return
Expand Down
16 changes: 8 additions & 8 deletions internal/delivery/http/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestServer_createTransfer(t *testing.T) {
Return(toAccount, nil)

store.EXPECT().
TransferTxAccount(gomock.Any(), gomock.Eq(db.TransferTxParams{
TransferTx(gomock.Any(), gomock.Eq(db.TransferTxParams{
FromAccountID: fromAccount.ID,
ToAccountID: toAccount.ID,
Amount: amount,
Expand Down Expand Up @@ -120,7 +120,7 @@ func TestServer_createTransfer(t *testing.T) {
},
buildStubs: func(store *mockdb.MockStore) {
store.EXPECT().
TransferTxAccount(gomock.Any(), gomock.Any()).
TransferTx(gomock.Any(), gomock.Any()).
Times(0)
},
checkResponse: func(t *testing.T, recorder *httptest.ResponseRecorder) {
Expand All @@ -142,7 +142,7 @@ func TestServer_createTransfer(t *testing.T) {
Return(db.Account{}, sql.ErrNoRows)

store.EXPECT().
TransferTxAccount(gomock.Any(), gomock.Any()).
TransferTx(gomock.Any(), gomock.Any()).
Times(0)
},
checkResponse: func(t *testing.T, recorder *httptest.ResponseRecorder) {
Expand All @@ -164,7 +164,7 @@ func TestServer_createTransfer(t *testing.T) {
Return(fromAccount, nil)

store.EXPECT().
TransferTxAccount(gomock.Any(), gomock.Any()).
TransferTx(gomock.Any(), gomock.Any()).
Times(0)
},
checkResponse: func(t *testing.T, recorder *httptest.ResponseRecorder) {
Expand All @@ -191,7 +191,7 @@ func TestServer_createTransfer(t *testing.T) {
Return(thirdAccount, nil)

store.EXPECT().
TransferTxAccount(gomock.Any(), gomock.Any()).
TransferTx(gomock.Any(), gomock.Any()).
Times(0)
},
checkResponse: func(t *testing.T, recorder *httptest.ResponseRecorder) {
Expand All @@ -217,7 +217,7 @@ func TestServer_createTransfer(t *testing.T) {
Times(0)

store.EXPECT().
TransferTxAccount(gomock.Any(), gomock.Eq(db.TransferTxParams{
TransferTx(gomock.Any(), gomock.Eq(db.TransferTxParams{
FromAccountID: fromAccount.ID,
ToAccountID: toAccount.ID,
Amount: amount,
Expand All @@ -228,7 +228,7 @@ func TestServer_createTransfer(t *testing.T) {
},
},
{
name: "500 Internal server error from TransferTxAccount",
name: "500 Internal server error from TransferTx",
body: gin.H{
"from_account_id": fromAccount.ID,
"to_account_id": toAccount.ID,
Expand All @@ -247,7 +247,7 @@ func TestServer_createTransfer(t *testing.T) {
Return(toAccount, nil)

store.EXPECT().
TransferTxAccount(gomock.Any(), gomock.Eq(db.TransferTxParams{
TransferTx(gomock.Any(), gomock.Eq(db.TransferTxParams{
FromAccountID: fromAccount.ID,
ToAccountID: toAccount.ID,
Amount: amount,
Expand Down

0 comments on commit df3b81c

Please sign in to comment.