chain test
This commit is contained in:
parent
75afb82966
commit
2367250def
1 changed files with 23 additions and 1 deletions
|
|
@ -1,11 +1,13 @@
|
|||
import { defaultInvoiceExpiry } from '../services/storage/paymentStorage.js'
|
||||
import { Describe, expect, expectThrowsAsync, runSanityCheck, safelySetUserBalance, SetupTest, TestBase } from './testBase.js'
|
||||
import * as Types from '../../proto/autogenerated/ts/types.js'
|
||||
export const ignore = false
|
||||
export const dev = false
|
||||
export default async (T: TestBase) => {
|
||||
await safelySetUserBalance(T, T.user1, 2000)
|
||||
await testSuccessfulExternalPayment(T)
|
||||
await testFailedExternalPayment(T)
|
||||
await testSuccesfulReceivedExternalChainPayment(T)
|
||||
await runSanityCheck(T)
|
||||
}
|
||||
|
||||
|
|
@ -44,4 +46,24 @@ const testFailedExternalPayment = async (T: TestBase) => {
|
|||
const owner = await T.main.storage.userStorage.GetUser(application.owner.user_id)
|
||||
expect(owner.balance_sats).to.be.equal(3)
|
||||
T.d("app balance is still 3 sats")
|
||||
}
|
||||
}
|
||||
|
||||
const testSuccesfulReceivedExternalChainPayment = async (T: TestBase) => {
|
||||
T.d("starting testSuccesfulReceivedExternalChainPayment")
|
||||
const balanceBefore = await T.main.storage.userStorage.GetUser(T.user1.userId)
|
||||
expect(balanceBefore.balance_sats).to.be.equal(0)
|
||||
const user2Address = await T.main.paymentManager.NewAddress({ app_id: T.app.appId, app_user_id: T.user2.appUserIdentifier, user_id: T.user2.userId }, { addressType: Types.AddressType.WITNESS_PUBKEY_HASH })
|
||||
expect(user2Address.address).to.startWith("bc1")
|
||||
T.d("generated external chain address for user2")
|
||||
const payment = await T.externalAccessToOtherLnd.PayAddress(user2Address.address, 1000, 3, "test", { from: 'system', useProvider: false })
|
||||
expect(payment.txid).to.not.be.undefined
|
||||
T.d("paid 1000 sats to user2's external chain address")
|
||||
const u2 = await T.main.storage.userStorage.GetUser(T.user2.userId)
|
||||
expect(u2.balance_sats).to.be.equal(1000)
|
||||
T.d("user2 balance is now 1000")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue