diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-22 22:05:32 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-01-03 18:37:38 +0800 |
commit | e744e4cd989bd3ae1070c59f7baa8097f18b8b06 (patch) | |
tree | a7fde03873f3c1b8689d3991edbb362f8022e5f0 /packages/subproviders/test/unit | |
parent | 9a96e8c704b6f84e00bbe848159a4819844cf09d (diff) | |
download | dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.gz dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.bz2 dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.lz dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.xz dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.zst dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.zip |
Apply prettier config
Diffstat (limited to 'packages/subproviders/test/unit')
-rw-r--r-- | packages/subproviders/test/unit/ledger_subprovider_test.ts | 38 | ||||
-rw-r--r-- | packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts | 19 |
2 files changed, 25 insertions, 32 deletions
diff --git a/packages/subproviders/test/unit/ledger_subprovider_test.ts b/packages/subproviders/test/unit/ledger_subprovider_test.ts index d493adf1e..22e77c5b3 100644 --- a/packages/subproviders/test/unit/ledger_subprovider_test.ts +++ b/packages/subproviders/test/unit/ledger_subprovider_test.ts @@ -5,16 +5,10 @@ import Web3 = require('web3'); import Web3ProviderEngine = require('web3-provider-engine'); import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); -import { - LedgerSubprovider, -} from '../../src'; -import { - DoneCallback, - LedgerCommunicationClient, - LedgerSubproviderErrors, -} from '../../src/types'; -import {chaiSetup} from '../chai_setup'; -import {reportCallbackErrors} from '../utils/report_callback_errors'; +import { LedgerSubprovider } from '../../src'; +import { DoneCallback, LedgerCommunicationClient, LedgerSubproviderErrors } from '../../src/types'; +import { chaiSetup } from '../chai_setup'; +import { reportCallbackErrors } from '../utils/report_callback_errors'; chaiSetup.configure(); const expect = chai.expect; @@ -29,7 +23,8 @@ describe('LedgerSubprovider', () => { const ledgerEthClient = { getAddress_async: async () => { // tslint:disable-next-line:max-line-length - const publicKey = '04f428290f4c5ed6a198f71b8205f488141dbb3f0840c923bbfa798ecbee6370986c03b5575d94d506772fb48a6a44e345e4ebd4f028a6f609c44b655d6d3e71a1'; + const publicKey = + '04f428290f4c5ed6a198f71b8205f488141dbb3f0840c923bbfa798ecbee6370986c03b5575d94d506772fb48a6a44e345e4ebd4f028a6f609c44b655d6d3e71a1'; const chainCode = 'ac055a5537c0c7e9e02d14a197cad6b857836da2a12043b46912a37d959b5ae8'; const address = '0xBa388BA5e5EEF2c6cE42d831c2B3A28D3c99bdB1'; return { @@ -77,16 +72,20 @@ describe('LedgerSubprovider', () => { const data = ethUtils.bufferToHex(ethUtils.toBuffer('hello world')); const ecSignatureHex = await ledgerSubprovider.signPersonalMessageAsync(data); // tslint:disable-next-line:max-line-length - expect(ecSignatureHex).to.be.equal('0xa6cc284bff14b42bdf5e9286730c152be91719d478605ec46b3bebcd0ae491480652a1a7b742ceb0213d1e744316e285f41f878d8af0b8e632cbca4c279132d001'); + expect(ecSignatureHex).to.be.equal( + '0xa6cc284bff14b42bdf5e9286730c152be91719d478605ec46b3bebcd0ae491480652a1a7b742ceb0213d1e744316e285f41f878d8af0b8e632cbca4c279132d001', + ); }); }); describe('failure cases', () => { it('cannot open multiple simultaneous connections to the Ledger device', async () => { const data = ethUtils.bufferToHex(ethUtils.toBuffer('hello world')); - return expect(Promise.all([ - ledgerSubprovider.getAccountsAsync(), - ledgerSubprovider.signPersonalMessageAsync(data), - ])).to.be.rejectedWith(LedgerSubproviderErrors.MultipleOpenConnectionsDisallowed); + return expect( + Promise.all([ + ledgerSubprovider.getAccountsAsync(), + ledgerSubprovider.signPersonalMessageAsync(data), + ]), + ).to.be.rejectedWith(LedgerSubproviderErrors.MultipleOpenConnectionsDisallowed); }); }); }); @@ -128,7 +127,9 @@ describe('LedgerSubprovider', () => { const callback = reportCallbackErrors(done)((err: Error, response: Web3.JSONRPCResponsePayload) => { expect(err).to.be.a('null'); // tslint:disable-next-line:max-line-length - expect(response.result).to.be.equal('0xa6cc284bff14b42bdf5e9286730c152be91719d478605ec46b3bebcd0ae491480652a1a7b742ceb0213d1e744316e285f41f878d8af0b8e632cbca4c279132d001'); + expect(response.result).to.be.equal( + '0xa6cc284bff14b42bdf5e9286730c152be91719d478605ec46b3bebcd0ae491480652a1a7b742ceb0213d1e744316e285f41f878d8af0b8e632cbca4c279132d001', + ); done(); }); provider.sendAsync(payload, callback); @@ -221,8 +222,7 @@ describe('LedgerSubprovider', () => { }); provider.sendAsync(payload, callback); }); - it('should throw if `from` param invalid address when calling eth_sendTransaction', - (done: DoneCallback) => { + it('should throw if `from` param invalid address when calling eth_sendTransaction', (done: DoneCallback) => { const tx = { to: '0xafa3f8684e54059998bc3a7b0d2b0da075154d66', from: '0xIncorrectEthereumAddress', diff --git a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts index 2f1676915..c3170745c 100644 --- a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts +++ b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts @@ -3,12 +3,10 @@ import * as _ from 'lodash'; import Web3 = require('web3'); import Web3ProviderEngine = require('web3-provider-engine'); -import {RedundantRPCSubprovider} from '../../src'; -import { - DoneCallback, -} from '../../src/types'; -import {chaiSetup} from '../chai_setup'; -import {reportCallbackErrors} from '../utils/report_callback_errors'; +import { RedundantRPCSubprovider } from '../../src'; +import { DoneCallback } from '../../src/types'; +import { chaiSetup } from '../chai_setup'; +import { reportCallbackErrors } from '../utils/report_callback_errors'; const expect = chai.expect; chaiSetup.configure(); @@ -17,9 +15,7 @@ describe('RedundantRpcSubprovider', () => { let provider: Web3ProviderEngine; it('succeeds when supplied a healthy endpoint', (done: DoneCallback) => { provider = new Web3ProviderEngine(); - const endpoints = [ - 'http://localhost:8545', - ]; + const endpoints = ['http://localhost:8545']; const redundantSubprovider = new RedundantRPCSubprovider(endpoints); provider.addProvider(redundantSubprovider); provider.start(); @@ -39,10 +35,7 @@ describe('RedundantRpcSubprovider', () => { }); it('succeeds when supplied at least one healthy endpoint', (done: DoneCallback) => { provider = new Web3ProviderEngine(); - const endpoints = [ - 'http://does-not-exist:3000', - 'http://localhost:8545', - ]; + const endpoints = ['http://does-not-exist:3000', 'http://localhost:8545']; const redundantSubprovider = new RedundantRPCSubprovider(endpoints); provider.addProvider(redundantSubprovider); provider.start(); |