From 13e667202835b082eb840ec2fb59511d687acdba Mon Sep 17 00:00:00 2001 From: Thomas Huang Date: Sun, 28 May 2017 11:18:07 -0700 Subject: Linting --- test/lib/mock-store.js | 2 +- test/unit/components/bn-as-decimal-input-test.js | 6 ++--- test/unit/components/pending-tx-test.js | 31 +++++++++++------------- test/unit/explorer-link-test.js | 1 - test/unit/migrator-test.js | 2 +- test/unit/network-contoller-test.js | 8 +++--- test/unit/tx-controller-test.js | 1 - 7 files changed, 23 insertions(+), 28 deletions(-) (limited to 'test') diff --git a/test/lib/mock-store.js b/test/lib/mock-store.js index 4714c3485..0d50e2d9c 100644 --- a/test/lib/mock-store.js +++ b/test/lib/mock-store.js @@ -2,7 +2,7 @@ const createStore = require('redux').createStore const applyMiddleware = require('redux').applyMiddleware const thunkMiddleware = require('redux-thunk') const createLogger = require('redux-logger') -const rootReducer = function() {} +const rootReducer = function () {} module.exports = configureStore diff --git a/test/unit/components/bn-as-decimal-input-test.js b/test/unit/components/bn-as-decimal-input-test.js index b3365b6f9..106b3a871 100644 --- a/test/unit/components/bn-as-decimal-input-test.js +++ b/test/unit/components/bn-as-decimal-input-test.js @@ -18,7 +18,7 @@ describe('BnInput', function () { } const value = new BN(valueStr, 10) - let inputStr = '2.3' + const inputStr = '2.3' let targetStr = '23' while (targetStr.length < 19) { @@ -43,9 +43,9 @@ describe('BnInput', function () { const component = additions.renderIntoDocument(inputComponent) renderer.render(inputComponent) const input = additions.find(component, 'input.hex-input')[0] - ReactTestUtils.Simulate.change(input, { preventDefault() {}, target: { + ReactTestUtils.Simulate.change(input, { preventDefault () {}, target: { value: inputStr, - checkValidity() { return true } }, + checkValidity () { return true } }, }) }) }) diff --git a/test/unit/components/pending-tx-test.js b/test/unit/components/pending-tx-test.js index 52e5e5910..22a98bc93 100644 --- a/test/unit/components/pending-tx-test.js +++ b/test/unit/components/pending-tx-test.js @@ -15,23 +15,22 @@ describe('PendingTx', function () { const gasPrice = '0x4A817C800' // 20 Gwei const txData = { - 'id':5021615666270214, - 'time':1494458763011, - 'status':'unapproved', - 'metamaskNetworkId':'1494442339676', - 'txParams':{ - 'from':'0xfdea65c8e26263f6d9a1b5de9555d2931a33b826', - 'to':'0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb', - 'value':'0xde0b6b3a7640000', + 'id': 5021615666270214, + 'time': 1494458763011, + 'status': 'unapproved', + 'metamaskNetworkId': '1494442339676', + 'txParams': { + 'from': '0xfdea65c8e26263f6d9a1b5de9555d2931a33b826', + 'to': '0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb', + 'value': '0xde0b6b3a7640000', gasPrice, - 'gas':'0x7b0c'}, - 'gasLimitSpecified':false, - 'estimatedGas':'0x5208', + 'gas': '0x7b0c'}, + 'gasLimitSpecified': false, + 'estimatedGas': '0x5208', } it('should use updated values when edited.', function (done) { - const renderer = ReactTestUtils.createRenderer() const newGasPrice = '0x77359400' @@ -40,7 +39,6 @@ describe('PendingTx', function () { accounts: identities, txData, sendTransaction: (txMeta, event) => { - // Assert changes: const result = ethUtil.addHexPrefix(txMeta.txParams.gasPrice) assert.notEqual(result, gasPrice, 'gas price should change') @@ -60,17 +58,16 @@ describe('PendingTx', function () { ReactTestUtils.Simulate.change(input, { target: { value: 2, - checkValidity() { return true }, + checkValidity () { return true }, }, }) const form = additions.find(component, 'form')[0] form.checkValidity = () => true - form.getFormEl = () => { return { checkValidity() { return true } } } - ReactTestUtils.Simulate.submit(form, { preventDefault() {}, target: { checkValidity() { + form.getFormEl = () => { return { checkValidity () { return true } } } + ReactTestUtils.Simulate.submit(form, { preventDefault () {}, target: { checkValidity () { return true } } }) - } catch (e) { console.log('WHAAAA') console.error(e) diff --git a/test/unit/explorer-link-test.js b/test/unit/explorer-link-test.js index e672b36ed..a02564509 100644 --- a/test/unit/explorer-link-test.js +++ b/test/unit/explorer-link-test.js @@ -11,5 +11,4 @@ describe('explorer-link', function () { var result = linkGen('hash', '42') assert.notEqual(result.indexOf('kovan'), -1, 'kovan injected') }) - }) diff --git a/test/unit/migrator-test.js b/test/unit/migrator-test.js index ece95b9f6..16066fefe 100644 --- a/test/unit/migrator-test.js +++ b/test/unit/migrator-test.js @@ -28,7 +28,7 @@ const migrations = [ }, }, ] -const versionedData = {meta: {version: 0}, data:{hello:'world'}} +const versionedData = {meta: {version: 0}, data: {hello: 'world'}} describe('Migrator', () => { const migrator = new Migrator({ migrations }) it('migratedData version should be version 3', (done) => { diff --git a/test/unit/network-contoller-test.js b/test/unit/network-contoller-test.js index 76452b303..0c7ee9d70 100644 --- a/test/unit/network-contoller-test.js +++ b/test/unit/network-contoller-test.js @@ -27,7 +27,7 @@ describe('# Network Controller', function () { }) }) describe('network', function () { - describe('#provider', function() { + describe('#provider', function () { it('provider should be updatable without reassignment', function () { networkController.initializeProvider(networkController.providerInit) const provider = networkController.provider @@ -37,7 +37,7 @@ describe('# Network Controller', function () { }) describe('#getNetworkState', function () { it('should return loading when new', function () { - let networkState = networkController.getNetworkState() + const networkState = networkController.getNetworkState() assert.equal(networkState, 'loading', 'network is loading') }) }) @@ -45,14 +45,14 @@ describe('# Network Controller', function () { describe('#setNetworkState', function () { it('should update the network', function () { networkController.setNetworkState(1) - let networkState = networkController.getNetworkState() + const networkState = networkController.getNetworkState() assert.equal(networkState, 1, 'network is 1') }) }) describe('#getRpcAddressForType', function () { it('should return the right rpc address', function () { - let rpcTarget = networkController.getRpcAddressForType('mainnet') + const rpcTarget = networkController.getRpcAddressForType('mainnet') assert.equal(rpcTarget, 'https://mainnet.infura.io/metamask', 'returns the right rpcAddress') }) }) diff --git a/test/unit/tx-controller-test.js b/test/unit/tx-controller-test.js index 711e1ea79..3954300a8 100644 --- a/test/unit/tx-controller-test.js +++ b/test/unit/tx-controller-test.js @@ -320,5 +320,4 @@ describe('Transaction Controller', function () { }) }) }) - }) -- cgit