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:
Mayukha Vadari
2021-09-07 14:25:39 -05:00
parent c8a2a6690b
commit 949cc031ee
44 changed files with 342 additions and 402 deletions

View File

@@ -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) {