Skip to content

Commit

Permalink
fix: accomodate invoicesFor change in test
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Dec 11, 2023
1 parent 838b226 commit 50cbdc1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
6 changes: 2 additions & 4 deletions integration_tests/hodl_invoice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,8 @@ func (suite *HodlInvoiceSuite) TestHodlInvoice() {
if err != nil {
fmt.Printf("Error when getting invoices %v\n", err.Error())
}
assert.Equal(suite.T(), 1, len(invoices))
assert.Equal(suite.T(), common.InvoiceStateError, invoices[0].State)
errorString := "FAILURE_REASON_INCORRECT_PAYMENT_DETAILS"
assert.Equal(suite.T(), errorString, invoices[0].ErrorMessage)
// make sure erroneous invoices are not listed
assert.Equal(suite.T(), 0, len(invoices))

transactionEntries, err := suite.service.TransactionEntriesFor(context.Background(), userId)
if err != nil {
Expand Down
7 changes: 3 additions & 4 deletions integration_tests/internal_payment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,9 @@ func (suite *PaymentTestSuite) TestInternalPaymentFail() {
fmt.Printf("Error when getting invoices %v\n", err.Error())
}

// check if first one is settled, but second one error (they are ordered desc by id)
assert.Equal(suite.T(), 2, len(invoices))
assert.Equal(suite.T(), common.InvoiceStateError, invoices[0].State)
assert.Equal(suite.T(), common.InvoiceStateSettled, invoices[1].State)
// check if first one is settled, second one is erroneous and hence isn't listed
assert.Equal(suite.T(), 1, len(invoices))
assert.Equal(suite.T(), common.InvoiceStateSettled, invoices[0].State)
transactionEntries, err := suite.service.TransactionEntriesFor(context.Background(), userId)
if err != nil {
fmt.Printf("Error when getting transaction entries %v\n", err.Error())
Expand Down
7 changes: 2 additions & 5 deletions integration_tests/keysend_failure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,8 @@ func (suite *KeySendFailureTestSuite) TestKeysendPayment() {
if err != nil {
fmt.Printf("Error when getting invoices %v\n", err.Error())
}
assert.Equal(suite.T(), 1, len(invoices))
assert.Equal(suite.T(), common.InvoiceStateError, invoices[0].State)
assert.Equal(suite.T(), SendPaymentMockError, invoices[0].ErrorMessage)
assert.NotEmpty(suite.T(), invoices[0].RHash)
assert.NotEmpty(suite.T(), invoices[0].Preimage)
// make sure the erroneous invoice isn't listed
assert.Equal(suite.T(), 0, len(invoices))
}

func TestKeySendFailureTestSuite(t *testing.T) {
Expand Down
5 changes: 2 additions & 3 deletions integration_tests/payment_failure_async_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ func (suite *PaymentTestAsyncErrorsSuite) TestExternalAsyncFailingInvoice() {
if err != nil {
fmt.Printf("Error when getting invoices %v\n", err.Error())
}
assert.Equal(suite.T(), 1, len(invoices))
assert.Equal(suite.T(), common.InvoiceStateError, invoices[0].State)
assert.Equal(suite.T(), SendPaymentMockError, invoices[0].ErrorMessage)
// make sure the erroneous invoice isn't listed
assert.Equal(suite.T(), 0, len(invoices))

transactionEntries, err := suite.service.TransactionEntriesFor(context.Background(), userId)
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions integration_tests/payment_failure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ func (suite *PaymentTestErrorsSuite) TestExternalFailingInvoice() {
if err != nil {
fmt.Printf("Error when getting invoices %v\n", err.Error())
}
assert.Equal(suite.T(), 1, len(invoices))
assert.Equal(suite.T(), common.InvoiceStateError, invoices[0].State)
assert.Equal(suite.T(), SendPaymentMockError, invoices[0].ErrorMessage)
// make sure the erroneous invoice isn't listed
assert.Equal(suite.T(), 0, len(invoices))

transactionEntries, err := suite.service.TransactionEntriesFor(context.Background(), userId)
if err != nil {
Expand Down

0 comments on commit 50cbdc1

Please sign in to comment.