mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
Add bookOrder, depositAuthorized, and ripplePathFind, and pathFind integration and browser tests
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { assert } from 'chai'
|
|
import _ from 'lodash'
|
|
|
|
import { BookOffersRequest, BookOffersResponse } 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('book_offers', function () {
|
|
this.timeout(TIMEOUT)
|
|
|
|
before(suiteClientSetup)
|
|
beforeEach(_.partial(setupClient, serverUrl))
|
|
afterEach(teardownClient)
|
|
|
|
it('base', async function () {
|
|
const bookOffer: BookOffersRequest = {
|
|
command: 'book_offers',
|
|
taker_gets: {
|
|
currency: 'XRP',
|
|
},
|
|
taker_pays: {
|
|
currency: 'USD',
|
|
issuer: this.wallet.getClassicAddress(),
|
|
},
|
|
}
|
|
const response = await this.client.request(bookOffer)
|
|
|
|
const expectedResponse: BookOffersResponse = {
|
|
id: response.id,
|
|
status: 'success',
|
|
type: 'response',
|
|
result: {
|
|
ledger_current_index: response.result.ledger_current_index,
|
|
offers: response.result.offers,
|
|
validated: false,
|
|
},
|
|
}
|
|
|
|
assert.deepEqual(response, expectedResponse)
|
|
})
|
|
})
|