mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
* lint broadcastClient * lint client * fix most of connection * remove unused files * lint mockRippled * lint mockRippledTest * lint runClientTests * lint setupClient * lint setupClientWeb * lint shamap * lint testUtils * resolve tsc issues * Fix tests * lint rest of connection * respond to comments
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { assert } from 'chai'
|
|
import _ from 'lodash'
|
|
|
|
import { Client } from 'xrpl-local'
|
|
|
|
import { setupClient, teardownClient } from './setupClient'
|
|
|
|
// how long before each test case times out
|
|
const TIMEOUT = 20000
|
|
|
|
describe('Client', function () {
|
|
this.timeout(TIMEOUT)
|
|
beforeEach(setupClient)
|
|
afterEach(teardownClient)
|
|
|
|
it('Client - implicit server port', function () {
|
|
// eslint-disable-next-line no-new -- Need to test constructor
|
|
new Client('wss://s1.ripple.com')
|
|
})
|
|
|
|
it('Client invalid options', function () {
|
|
// @ts-expect-error - This is intentionally invalid
|
|
assert.throws(() => new Client({ invalid: true }))
|
|
})
|
|
|
|
it('Client valid options', function () {
|
|
const client = new Client('wss://s:1')
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: fix when src/client linting is merged
|
|
const privateConnectionUrl = (client.connection as any).url
|
|
assert.deepEqual(privateConnectionUrl, 'wss://s:1')
|
|
})
|
|
|
|
it('Client invalid server uri', function () {
|
|
assert.throws(() => new Client('wss//s:1'))
|
|
})
|
|
|
|
it('Client connect() times out after 2 seconds', function () {
|
|
// TODO: Use a timer mock like https://jestjs.io/docs/en/timer-mocks
|
|
// to test that connect() times out after 2 seconds.
|
|
})
|
|
})
|