fix: make docs not output confusing information in xrpl client (#2337)

* fix: make docs not output confusing information in xrpl client

---------

Co-authored-by: Jackson Mills <jmills@ripple.com>
Co-authored-by: Caleb Kniffen <ckniffen@ripple.com>
This commit is contained in:
justinr1234
2023-08-14 19:11:41 -05:00
committed by Caleb Kniffen
parent 21c2423bac
commit 3b70a3b919
28 changed files with 1718 additions and 879 deletions

View File

@@ -13,6 +13,7 @@ import {
ResponseFormatError,
XrplError,
TimeoutError,
SubscribeRequest,
} from '../src'
import { Connection } from '../src/client/connection'
@@ -347,6 +348,7 @@ describe('Connection', function () {
'DisconnectedError',
async () => {
await clientContext.client
// @ts-expect-error -- Intentionally invalid command
.request({ command: 'test_command', data: { closeServer: true } })
.then(() => {
assert.fail('Should throw DisconnectedError')
@@ -438,7 +440,7 @@ describe('Connection', function () {
try {
await clientContext.client.connect()
} catch (error) {
// @ts-expect-error -- error.message is expected to be defined
// @ts-expect-error -- Error has a message
expect(error.message).toEqual(
"Error: connect() timed out after 5000 ms. If your internet connection is working, the rippled server may be blocked or inaccessible. You can also try setting the 'connectionTimeout' option in the Client constructor.",
)
@@ -457,6 +459,7 @@ describe('Connection', function () {
async () => {
await clientContext.client
.request({
// @ts-expect-error -- Intentionally invalid command
command: 'test_command',
data: { unrecognizedResponse: true },
})
@@ -847,7 +850,10 @@ describe('Connection', function () {
it(
'propagates RippledError data',
async () => {
const request = { command: 'subscribe', streams: 'validations' }
const request: SubscribeRequest = {
command: 'subscribe',
streams: ['validations'],
}
clientContext.mockRippled?.addResponse(
request.command,
rippled.subscribe.error,