Files
xahau.js/packages/xrpl/test/integration/requests/utility.test.ts
2023-02-03 17:03:07 -06:00

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,
)
})