mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-03 02:25:49 +00:00
Lints top-level test files (#1594)
* 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
This commit is contained in:
@@ -1,35 +1,30 @@
|
||||
import { assert } from 'chai'
|
||||
import _ from 'lodash'
|
||||
|
||||
import { ServerInfoResponse } from '../src'
|
||||
|
||||
import responses from './fixtures/responses'
|
||||
import rippled from './fixtures/rippled'
|
||||
import setupClient from './setupClient'
|
||||
import { ignoreWebSocketDisconnect } from './testUtils'
|
||||
import { setupBroadcast, teardownClient } from './setupClient'
|
||||
import { assertResultMatch, ignoreWebSocketDisconnect } from './testUtils'
|
||||
|
||||
const TIMEOUT = 20000
|
||||
|
||||
function checkResult(expected, response) {
|
||||
if (expected.txJSON) {
|
||||
assert(response.txJSON)
|
||||
assert.deepEqual(JSON.parse(response.txJSON), JSON.parse(expected.txJSON))
|
||||
}
|
||||
assert.deepEqual(_.omit(response, 'txJSON'), _.omit(expected, 'txJSON'))
|
||||
return response
|
||||
}
|
||||
|
||||
describe('BroadcastClient', function () {
|
||||
this.timeout(TIMEOUT)
|
||||
beforeEach(setupClient.setupBroadcast)
|
||||
afterEach(setupClient.teardown)
|
||||
beforeEach(setupBroadcast)
|
||||
afterEach(teardownClient)
|
||||
|
||||
it('base', function () {
|
||||
it('base', async function () {
|
||||
this.mocks.forEach((mock) => {
|
||||
mock.addResponse('server_info', rippled.server_info.normal)
|
||||
})
|
||||
assert(this.client.isConnected())
|
||||
return this.client.request({ command: 'server_info' }).then((response) => {
|
||||
return checkResult(responses.getServerInfo, response.result.info)
|
||||
})
|
||||
this.client
|
||||
.request({ command: 'server_info' })
|
||||
.then((response: ServerInfoResponse) => {
|
||||
assertResultMatch(responses.getServerInfo, response.result.info)
|
||||
})
|
||||
})
|
||||
|
||||
it('error propagation', function (done) {
|
||||
|
||||
Reference in New Issue
Block a user