test: add integration tests for Account requests (#1643)

This commit is contained in:
Mayukha Vadari
2021-09-24 12:20:04 -04:00
parent b5b2909fed
commit 564001515d
15 changed files with 551 additions and 34 deletions

View File

@@ -0,0 +1,48 @@
import { assert } from 'chai'
import _ from 'lodash'
import { GatewayBalancesRequest } from 'xrpl-local'
import serverUrl from '../serverUrl'
import { setupClient, suiteClientSetup, teardownClient } from '../setup'
// how long before each test case times out
const TIMEOUT = 20000
describe('gateway_balances', function () {
this.timeout(TIMEOUT)
before(suiteClientSetup)
beforeEach(_.partial(setupClient, serverUrl))
afterEach(teardownClient)
it('base', async function () {
const request: GatewayBalancesRequest = {
command: 'gateway_balances',
account: this.wallet.getClassicAddress(),
ledger_index: 'validated',
strict: true,
}
const response = await this.client.request(request)
const expected = {
id: 0,
result: {
account: this.wallet.getClassicAddress(),
ledger_hash:
'28D68B351ED58B9819502EF5FC05BA4412A048597E5159E1C226703BDF7C7897',
ledger_index: 1294,
validated: true,
},
status: 'success',
type: 'response',
}
assert.equal(response.status, expected.status)
assert.equal(response.type, expected.type)
assert.equal(typeof response.result.ledger_hash, 'string')
assert.equal(typeof response.result.ledger_index, 'number')
assert.deepEqual(
_.omit(response.result, ['ledger_hash', 'ledger_index']),
_.omit(expected.result, ['ledger_hash', 'ledger_index']),
)
})
})