mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import { assert } from 'chai'
|
|
import omit from 'lodash/omit'
|
|
|
|
import serverUrl from '../serverUrl'
|
|
import {
|
|
setupClient,
|
|
teardownClient,
|
|
type XrplIntegrationTestContext,
|
|
} from '../setup'
|
|
|
|
// how long before each test case times out
|
|
const TIMEOUT = 20000
|
|
|
|
describe('Utility method integration tests', function () {
|
|
let testContext: XrplIntegrationTestContext
|
|
|
|
beforeEach(async () => {
|
|
testContext = await setupClient(serverUrl)
|
|
})
|
|
afterEach(async () => teardownClient(testContext))
|
|
|
|
it(
|
|
'ping',
|
|
async () => {
|
|
const response = await testContext.client.request({
|
|
command: 'ping',
|
|
})
|
|
const expected: unknown = {
|
|
result: { role: 'admin', unlimited: true },
|
|
type: 'response',
|
|
}
|
|
assert.deepEqual(omit(response, 'id'), expected)
|
|
},
|
|
TIMEOUT,
|
|
)
|
|
|
|
it(
|
|
'random',
|
|
async () => {
|
|
const response = await testContext.client.request({
|
|
command: 'random',
|
|
})
|
|
const expected = {
|
|
id: 0,
|
|
result: {
|
|
random: '[random string of 64 bytes]',
|
|
},
|
|
type: 'response',
|
|
}
|
|
assert.equal(response.type, expected.type)
|
|
assert.equal(response.result.random.length, 64)
|
|
},
|
|
TIMEOUT,
|
|
)
|
|
})
|