Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Jul 21, 2024
1 parent 5cc294f commit a6586f4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions transactions/app_payments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestSendPaymentSync_App_NoPermission(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.Equal(t, "app does not have pay_invoice scope", err.Error())
Expand Down Expand Up @@ -55,7 +55,7 @@ func TestSendPaymentSync_App_WithPermission(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -89,7 +89,7 @@ func TestSendPaymentSync_App_BudgetExceeded(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewQuotaExceededError())
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestSendPaymentSync_App_BudgetExceeded_SettledPayment(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewQuotaExceededError())
Expand Down Expand Up @@ -168,7 +168,7 @@ func TestSendPaymentSync_App_BudgetExceeded_UnsettledPayment(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewQuotaExceededError())
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestSendPaymentSync_App_BudgetNotExceeded_FailedPayment(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down
14 changes: 7 additions & 7 deletions transactions/isolated_app_payments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestSendPaymentSync_IsolatedApp_NoBalance(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewInsufficientBalanceError())
Expand Down Expand Up @@ -74,7 +74,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceInsufficient(t *testing.T) {
})

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewInsufficientBalanceError())
Expand Down Expand Up @@ -113,7 +113,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceSufficient(t *testing.T) {
})

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -162,7 +162,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceInsufficient_OutstandingPayment(t *t
})

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewInsufficientBalanceError())
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceInsufficient_SettledPayment(t *testi
})

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.Error(t, err)
assert.ErrorIs(t, err, NewInsufficientBalanceError())
Expand Down Expand Up @@ -253,7 +253,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceSufficient_UnrelatedPayment(t *testi
})

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down Expand Up @@ -301,7 +301,7 @@ func TestSendPaymentSync_IsolatedApp_BalanceSufficient_FailedPayment(t *testing.
})

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, &app.ID, &dbRequestEvent.ID)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, &app.ID, &dbRequestEvent.ID)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand Down
6 changes: 3 additions & 3 deletions transactions/payments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestSendPaymentSync_NoApp(t *testing.T) {
assert.NoError(t, err)

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, nil, nil)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, nil, nil)

assert.NoError(t, err)
assert.Equal(t, uint64(123000), transaction.AmountMsat)
Expand All @@ -39,7 +39,7 @@ func TestSendPaymentSync_FailedRemovesFeeReserve(t *testing.T) {
svc.LNClient.(*tests.MockLn).PayInvoiceResponses = append(svc.LNClient.(*tests.MockLn).PayInvoiceResponses, nil)

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, nil, nil)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, nil, nil)

assert.Error(t, err)
assert.Nil(t, transaction)
Expand All @@ -66,7 +66,7 @@ func TestSendPaymentSync_PendingHasFeeReserve(t *testing.T) {
svc.LNClient.(*tests.MockLn).PayInvoiceResponses = append(svc.LNClient.(*tests.MockLn).PayInvoiceResponses, nil)

transactionsService := NewTransactionsService(svc.DB)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, svc.LNClient, nil, nil)
transaction, err := transactionsService.SendPaymentSync(ctx, tests.MockLNClientTransaction.Invoice, nil, svc.LNClient, nil, nil)

assert.Error(t, err)
assert.Nil(t, transaction)
Expand Down

0 comments on commit a6586f4

Please sign in to comment.