mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import { assert } from 'chai'
|
|
|
|
import { BookOffersRequest, BookOffersResponse } from '../../../src'
|
|
import serverUrl from '../serverUrl'
|
|
import {
|
|
setupClient,
|
|
teardownClient,
|
|
type XrplIntegrationTestContext,
|
|
} from '../setup'
|
|
|
|
// how long before each test case times out
|
|
const TIMEOUT = 20000
|
|
|
|
describe('book_offers', function () {
|
|
let testContext: XrplIntegrationTestContext
|
|
|
|
beforeEach(async () => {
|
|
testContext = await setupClient(serverUrl)
|
|
})
|
|
afterEach(async () => teardownClient(testContext))
|
|
|
|
it(
|
|
'base',
|
|
async () => {
|
|
const bookOffer: BookOffersRequest = {
|
|
command: 'book_offers',
|
|
taker_gets: {
|
|
currency: 'XAH',
|
|
},
|
|
taker_pays: {
|
|
currency: 'USD',
|
|
issuer: testContext.wallet.classicAddress,
|
|
},
|
|
}
|
|
const response = await testContext.client.request(bookOffer)
|
|
|
|
const expectedResponse: BookOffersResponse = {
|
|
id: response.id,
|
|
type: 'response',
|
|
result: {
|
|
ledger_current_index: response.result.ledger_current_index,
|
|
offers: response.result.offers,
|
|
validated: false,
|
|
},
|
|
}
|
|
|
|
assert.deepEqual(response, expectedResponse)
|
|
},
|
|
TIMEOUT,
|
|
)
|
|
})
|