test: Integration tests for Account Transactions (#1673)

* test: Integration tests for Account Transactions
This commit is contained in:
Mukul Jangid
2021-09-28 20:26:24 -04:00
committed by Mayukha Vadari
parent 8df224232c
commit a1dce6b1e0
2 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
import _ from 'lodash'
import { AccountDelete } from 'xrpl-local/models/transactions'
import serverUrl from '../serverUrl'
import { setupClient, suiteClientSetup, teardownClient } from '../setup'
import { generateFundedWallet, ledgerAccept, testTransaction } from '../utils'
// how long before each test case times out
const TIMEOUT = 20000
describe('AccountDelete', function () {
this.timeout(TIMEOUT)
before(suiteClientSetup)
beforeEach(_.partial(setupClient, serverUrl))
afterEach(teardownClient)
it('base', async function () {
const wallet2 = await generateFundedWallet(this.client)
// to the satisfy the condition that account sequence and current ledger_index should be 256 apart.
const promises: Array<Promise<void>> = []
for (let iter = 0; iter < 256; iter += 1) {
promises.push(ledgerAccept(this.client))
}
await Promise.all(promises)
const tx: AccountDelete = {
TransactionType: 'AccountDelete',
Account: this.wallet.getClassicAddress(),
Destination: wallet2.getClassicAddress(),
}
await testTransaction(this.client, tx, this.wallet)
})
})

View File

@@ -0,0 +1,26 @@
import _ from 'lodash'
import { AccountSet } from 'xrpl-local/models/transactions'
import serverUrl from '../serverUrl'
import { setupClient, suiteClientSetup, teardownClient } from '../setup'
import { testTransaction } from '../utils'
// how long before each test case times out
const TIMEOUT = 20000
describe('AccountSet', function () {
this.timeout(TIMEOUT)
before(suiteClientSetup)
beforeEach(_.partial(setupClient, serverUrl))
afterEach(teardownClient)
it('base', async function () {
const tx: AccountSet = {
TransactionType: 'AccountSet',
Account: this.wallet.getClassicAddress(),
}
await testTransaction(this.client, tx, this.wallet)
})
})