fix expected err
This commit is contained in:
parent
005add84bd
commit
edd7476af1
4 changed files with 4 additions and 4 deletions
|
|
@ -36,7 +36,7 @@ const testFailedExternalPayment = async (T: TestBase) => {
|
||||||
expect(invoice.payRequest).to.startWith("lnbcrt15u")
|
expect(invoice.payRequest).to.startWith("lnbcrt15u")
|
||||||
T.d("generated 1500 sats invoice for external node")
|
T.d("generated 1500 sats invoice for external node")
|
||||||
|
|
||||||
await expectThrowsAsync(T.main.paymentManager.PayInvoice(T.user1.userId, { invoice: invoice.payRequest, amount: 0 }, application), "not enough balance to decrement")
|
await expectThrowsAsync(T.main.paymentManager.PayInvoice(T.user1.userId, { invoice: invoice.payRequest, amount: 0 }, application), "Error: not enough balance to decrement")
|
||||||
T.d("payment failed as expected, with the expected error message")
|
T.d("payment failed as expected, with the expected error message")
|
||||||
const u1 = await T.main.storage.userStorage.GetUser(T.user1.userId)
|
const u1 = await T.main.storage.userStorage.GetUser(T.user1.userId)
|
||||||
expect(u1.balance_sats).to.be.equal(1496)
|
expect(u1.balance_sats).to.be.equal(1496)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ const testFailedInternalPayment = async (T: TestBase) => {
|
||||||
const invoice = await T.main.paymentManager.NewInvoice(T.user2.userId, { amountSats: 1000, memo: "test" }, { linkedApplication: application, expiry: defaultInvoiceExpiry })
|
const invoice = await T.main.paymentManager.NewInvoice(T.user2.userId, { amountSats: 1000, memo: "test" }, { linkedApplication: application, expiry: defaultInvoiceExpiry })
|
||||||
expect(invoice.invoice).to.startWith("lnbcrt10u")
|
expect(invoice.invoice).to.startWith("lnbcrt10u")
|
||||||
T.d("generated 1000 sats invoice for user2")
|
T.d("generated 1000 sats invoice for user2")
|
||||||
await expectThrowsAsync(T.main.paymentManager.PayInvoice(T.user1.userId, { invoice: invoice.invoice, amount: 0 }, application), "not enough balance to decrement")
|
await expectThrowsAsync(T.main.paymentManager.PayInvoice(T.user1.userId, { invoice: invoice.invoice, amount: 0 }, application), "Error: not enough balance to decrement")
|
||||||
T.d("payment failed as expected, with the expected error message")
|
T.d("payment failed as expected, with the expected error message")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ const testSpamExternalPayment = async (T: TestBase) => {
|
||||||
|
|
||||||
const successfulPayments = res.filter(r => r.success)
|
const successfulPayments = res.filter(r => r.success)
|
||||||
const failedPayments = res.filter(r => !r.success)
|
const failedPayments = res.filter(r => !r.success)
|
||||||
failedPayments.forEach(f => expect(f.err).to.be.equal("not enough balance to decrement"))
|
failedPayments.forEach(f => expect(f.err).to.be.equal("Error: not enough balance to decrement"))
|
||||||
successfulPayments.forEach(s => expect(s.result).to.contain({ amount_paid: 500, network_fee: 1, service_fee: 3 }))
|
successfulPayments.forEach(s => expect(s.result).to.contain({ amount_paid: 500, network_fee: 1, service_fee: 3 }))
|
||||||
expect(successfulPayments.length).to.be.equal(3)
|
expect(successfulPayments.length).to.be.equal(3)
|
||||||
expect(failedPayments.length).to.be.equal(7)
|
expect(failedPayments.length).to.be.equal(7)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const testSpamExternalPayment = async (T: TestBase) => {
|
||||||
|
|
||||||
const successfulPayments = res.filter(r => r.success) as { success: true, result: Types.PayInvoiceResponse }[]
|
const successfulPayments = res.filter(r => r.success) as { success: true, result: Types.PayInvoiceResponse }[]
|
||||||
const failedPayments = res.filter(r => !r.success)
|
const failedPayments = res.filter(r => !r.success)
|
||||||
failedPayments.forEach(f => expect(f.err).to.be.equal("not enough balance to decrement"))
|
failedPayments.forEach(f => expect(f.err).to.be.equal("Error: not enough balance to decrement"))
|
||||||
expect(successfulPayments.length).to.be.equal(3)
|
expect(successfulPayments.length).to.be.equal(3)
|
||||||
expect(failedPayments.length).to.be.equal(7)
|
expect(failedPayments.length).to.be.equal(7)
|
||||||
T.d("3 payments succeeded, 7 failed as expected")
|
T.d("3 payments succeeded, 7 failed as expected")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue