mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
* remove response.status * fix unit tests * fix integration tests * remove now-unneeded helper method * fix rename
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { assert } from 'chai'
|
|
import _ from 'lodash'
|
|
|
|
import { AccountOffersRequest } 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_offers', function () {
|
|
this.timeout(TIMEOUT)
|
|
|
|
before(suiteClientSetup)
|
|
beforeEach(_.partial(setupClient, serverUrl))
|
|
afterEach(teardownClient)
|
|
|
|
it('base', async function () {
|
|
const request: AccountOffersRequest = {
|
|
command: 'account_offers',
|
|
account: this.wallet.getClassicAddress(),
|
|
strict: true,
|
|
}
|
|
const response = await this.client.request(request)
|
|
const expected = {
|
|
id: 0,
|
|
result: {
|
|
account: this.wallet.getClassicAddress(),
|
|
ledger_current_index: 1443,
|
|
offers: [],
|
|
validated: false,
|
|
},
|
|
type: 'response',
|
|
}
|
|
assert.equal(response.type, expected.type)
|
|
assert.equal(typeof response.result.ledger_current_index, 'number')
|
|
assert.deepEqual(
|
|
_.omit(response.result, 'ledger_current_index'),
|
|
_.omit(expected.result, 'ledger_current_index'),
|
|
)
|
|
})
|
|
})
|