mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
refactor: move fixtures closer to tests (part 2) (#1561)
* move echo * move fee * move subscribe/unsubscribe * move ledger_current * move ledger_data * move submit/submit_multisigned * remove account_tx/account_offers/gateway_balances * move account_info * remove ledger_entry * remove tx * remove account_lines * remove ripple_path_find * remove ledger * remove book_offers * move ping * remove global_config * move test_command * additional mock-rippled cleanup * add explanatory comment to mock.addResponse
This commit is contained in:
@@ -4,6 +4,7 @@ import assert from 'assert-diff'
|
||||
import setupClient from './setupClient'
|
||||
import {Client} from 'xrpl-local'
|
||||
import {ignoreWebSocketDisconnect} from './testUtils'
|
||||
import rippled from './fixtures/rippled'
|
||||
const utils = Client._PRIVATE.ledgerUtils
|
||||
|
||||
const TIMEOUT = 200000 // how long before each test case times out
|
||||
@@ -158,6 +159,7 @@ describe('Connection', function () {
|
||||
})
|
||||
|
||||
it('DisconnectedError', async function () {
|
||||
this.mockRippled.suppressOutput = true
|
||||
this.mockRippled.on(`request_server_info`, function (request, conn) {
|
||||
assert.strictEqual(request.command, 'server_info')
|
||||
conn.close()
|
||||
@@ -505,7 +507,9 @@ describe('Connection', function () {
|
||||
})
|
||||
|
||||
it('propagates RippledError data', function (done) {
|
||||
this.client.request({command: 'subscribe', streams: 'validations'}).catch((error) => {
|
||||
const request = {command: 'subscribe', streams: 'validations'}
|
||||
this.mockRippled.addResponse(request, rippled.subscribe.error)
|
||||
this.client.request(request).catch((error) => {
|
||||
assert.strictEqual(error.name, 'RippledError')
|
||||
assert.strictEqual(error.data.error, 'invalidParams')
|
||||
assert.strictEqual(error.message, 'Invalid parameters.')
|
||||
|
||||
Reference in New Issue
Block a user