mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-28 16:15:49 +00:00
test: add integration tests for Account requests (#1643)
This commit is contained in:
49
test/integration/requests/accountCurrencies.ts
Normal file
49
test/integration/requests/accountCurrencies.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { assert } from 'chai'
|
||||
import _ from 'lodash'
|
||||
|
||||
import { AccountCurrenciesRequest } 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('account_currencies', function () {
|
||||
this.timeout(TIMEOUT)
|
||||
|
||||
before(suiteClientSetup)
|
||||
beforeEach(_.partial(setupClient, serverUrl))
|
||||
afterEach(teardownClient)
|
||||
|
||||
it('base', async function () {
|
||||
const request: AccountCurrenciesRequest = {
|
||||
command: 'account_currencies',
|
||||
account: this.wallet.getClassicAddress(),
|
||||
strict: true,
|
||||
ledger_index: 'validated',
|
||||
}
|
||||
const response = await this.client.request(request)
|
||||
const expected = {
|
||||
id: 0,
|
||||
result: {
|
||||
receive_currencies: [],
|
||||
send_currencies: [],
|
||||
ledger_hash:
|
||||
'C8BFA74A740AA22AD9BD724781589319052398B0C6C817B88D55628E07B7B4A1',
|
||||
ledger_index: 150,
|
||||
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']),
|
||||
)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user