mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
Added network id to the base transaction Added network id to the server_info response Added network id to the binary codec Added network id to client and modify on client.connect() Added network id to autofill when rippled_version is 1.11.0 or later or network is hooks testnet Co-authored-by: Phu Pham <ppham@ripple.com> Co-authored-by: pdp2121 <71317875+pdp2121@users.noreply.github.com> Co-authored-by: Jackson Mills <aim4math@gmail.com> Co-authored-by: Mayukha Vadari <mvadari@gmail.com>
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { assert } from 'chai'
|
|
|
|
import { RippledError } from '../src'
|
|
|
|
import {
|
|
setupClient,
|
|
teardownClient,
|
|
type XrplTestContext,
|
|
} from './setupClient'
|
|
import { assertRejects } from './testUtils'
|
|
|
|
describe('mock rippled tests', function () {
|
|
let testContext: XrplTestContext
|
|
|
|
beforeEach(async () => {
|
|
testContext = await setupClient()
|
|
})
|
|
afterEach(async () => teardownClient(testContext))
|
|
it('errors if a mock is not provided', async function () {
|
|
if (testContext.mockRippled) {
|
|
testContext.mockRippled.suppressOutput = true
|
|
}
|
|
|
|
await assertRejects(
|
|
testContext.client.request({ command: 'account_info' }),
|
|
RippledError,
|
|
)
|
|
})
|
|
|
|
it('provide bad response shape', async function () {
|
|
try {
|
|
testContext.mockRippled!.addResponse('account_info', { data: {} })
|
|
assert.fail('Should have errored')
|
|
} catch (err) {
|
|
if (!(err instanceof Error)) {
|
|
assert.fail(`Wrong error type: ${err as string}`)
|
|
}
|
|
}
|
|
})
|
|
|
|
it('provide bad response shape in function', async function () {
|
|
testContext.mockRippled!.suppressOutput = true
|
|
testContext.mockRippled!.addResponse('account_info', (request) => {
|
|
return { data: request }
|
|
})
|
|
await assertRejects(
|
|
testContext.client.request({ command: 'account_info', account: '' }),
|
|
RippledError,
|
|
)
|
|
})
|
|
})
|