convert the rest of the helper files to ts

This commit is contained in:
Fred K. Schott
2019-10-15 21:12:18 -07:00
parent 7ec128c2e4
commit 39f6a51794
16 changed files with 89 additions and 112 deletions

View File

@@ -1,5 +1,4 @@
'use strict';
const {RippleAPIBroadcast} = require('../../src');
import {RippleAPIBroadcast} from '../../src';
function main() {
const servers = ['wss://s1.ripple.com', 'wss://s2.ripple.com'];

View File

@@ -1,5 +1,4 @@
'use strict';
const Connection = require('../../src/common/connection');
import Connection from '../../src/common/connection';
const request1 = {
command: 'server_info'

View File

@@ -1,15 +1,12 @@
/* eslint-disable max-nested-callbacks */
/* eslint-disable max-params */
'use strict';
const _ = require('lodash');
const assert = require('assert');
const errors = require('../../src/common/errors');
const wallet = require('./wallet');
const requests = require('../fixtures/requests');
const RippleAPI = require('ripple-api').RippleAPI;
const {isValidAddress} = require('ripple-address-codec');
const {isValidSecret} = require('../../src/common');
const {payTo, ledgerAccept} = require('./utils');
import _ from 'lodash';
import assert from 'assert';
import wallet from './wallet';
import requests from '../fixtures/requests';
import {RippleAPI} from 'ripple-api';
import {isValidAddress} from 'ripple-address-codec';
import {payTo, ledgerAccept} from './utils';
import { errors } from 'ripple-api/common';
import { isValidSecret } from 'ripple-api/common/utils';
// how long before each test case times out
@@ -71,7 +68,7 @@ function testTransaction(testcase, type, lastClosedLedgerVersion, prepared,
});
}
function setup(server = 'wss://s1.ripple.com') {
function setup(this: any, server = 'wss://s1.ripple.com') {
this.api = new RippleAPI({server});
console.log('CONNECTING...');
return this.api.connect().then(() => {
@@ -167,11 +164,11 @@ function setupAccounts(testcase) {
return promise;
}
function teardown() {
function teardown(this: any) {
return this.api.disconnect();
}
function suiteSetup() {
function suiteSetup(this: any) {
this.transactions = [];
return setup.bind(this)(serverUrl)