mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
respond to comments
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import assert from 'assert-diff';
|
import assert from 'assert-diff';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { RippleAPI } from 'ripple-api';
|
import {RippleAPI} from 'ripple-api';
|
||||||
import { RecursiveData } from 'ripple-api/ledger/utils';
|
import {RecursiveData} from 'ripple-api/ledger/utils';
|
||||||
import binary from 'ripple-binary-codec';
|
import binary from 'ripple-binary-codec';
|
||||||
import requests from './fixtures/requests';
|
import requests from './fixtures/requests';
|
||||||
import responses from './fixtures/responses';
|
import responses from './fixtures/responses';
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import requests from '../fixtures/requests';
|
|||||||
import {RippleAPI} from 'ripple-api';
|
import {RippleAPI} from 'ripple-api';
|
||||||
import {isValidAddress} from 'ripple-address-codec';
|
import {isValidAddress} from 'ripple-address-codec';
|
||||||
import {payTo, ledgerAccept} from './utils';
|
import {payTo, ledgerAccept} from './utils';
|
||||||
import { errors } from 'ripple-api/common';
|
import {errors} from 'ripple-api/common';
|
||||||
import { isValidSecret } from 'ripple-api/common/utils';
|
import {isValidSecret} from 'ripple-api/common/utils';
|
||||||
|
|
||||||
|
|
||||||
// how long before each test case times out
|
// how long before each test case times out
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import transactionsResponse from './fixtures/rippled/account-tx';
|
|||||||
import accountLinesResponse from './fixtures/rippled/account-lines';
|
import accountLinesResponse from './fixtures/rippled/account-lines';
|
||||||
import accountObjectsResponse from './fixtures/rippled/account-objects';
|
import accountObjectsResponse from './fixtures/rippled/account-objects';
|
||||||
import fullLedger from './fixtures/rippled/ledger-full-38129.json';
|
import fullLedger from './fixtures/rippled/ledger-full-38129.json';
|
||||||
import { getFreePort } from './utils/net-utils';
|
import {getFreePort} from './utils/net-utils';
|
||||||
|
|
||||||
function isUSD(json) {
|
function isUSD(json) {
|
||||||
return json === 'USD' || json === '0000000000000000000000005553440000000000';
|
return json === 'USD' || json === '0000000000000000000000005553440000000000';
|
||||||
@@ -48,17 +48,12 @@ function createLedgerResponse(request, response) {
|
|||||||
return JSON.stringify(newResponse);
|
return JSON.stringify(newResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CustomWebSocketServer extends WebSocketServer, EventEmitter2 {
|
// We mock out WebSocketServer in these tests and add a lot of custom
|
||||||
expectedRequests: any
|
// properties not defined on the normal WebSocketServer object.
|
||||||
expect: any
|
type MockedWebSocketServer = any;
|
||||||
config: any
|
|
||||||
socket: any
|
|
||||||
onAny: any
|
|
||||||
event: any
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createMockRippled(port) {
|
export function createMockRippled(port) {
|
||||||
const mock = new WebSocketServer({ port: port }) as CustomWebSocketServer;
|
const mock = new WebSocketServer({ port: port }) as MockedWebSocketServer;
|
||||||
_.assign(mock, EventEmitter2.prototype);
|
_.assign(mock, EventEmitter2.prototype);
|
||||||
|
|
||||||
const close = mock.close;
|
const close = mock.close;
|
||||||
|
|||||||
Reference in New Issue
Block a user