From 25eb917c600eeb6af46ff262e16fa54d5df9134d Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 27 Mar 2018 13:59:37 -0700 Subject: [PATCH 01/16] Update blacklist --- test/stub/blacklist.json | 325 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 320 insertions(+), 5 deletions(-) diff --git a/test/stub/blacklist.json b/test/stub/blacklist.json index 6a3230b2f..14a890fec 100644 --- a/test/stub/blacklist.json +++ b/test/stub/blacklist.json @@ -5,9 +5,68 @@ "metamask.io", "myetherwallet.com", "cryptokitties.co", - "mycrypto.com" + "mycrypto.com", + "localethereum.com", + "dfinity.org" ], "whitelist": [ + "ncrypto.com", + "mrcrypto.dk", + "nedfinity.com", + "affinity.me", + "crypto.cat", + "winity.io", + "gfinity.net", + "p-crypto.ru", + "mycryptons.com", + "aicrypto.ai", + "azcrypto.net", + "crypto.com", + "affinity.photography", + "abcrypto.info", + "ucrypto.net", + "vscrypto.com", + "affinity.com", + "affinity.co", + "crypto.news", + "dbcrypto.com", + "ezcrypto.guide", + "gocrypto.me", + "finity.ai", + "weffkemining.com", + "nwcrypto.com", + "cobinhood.com", + "affinity.vc", + "trinity.tech", + "metahusk.com", + "mrcrypto.fr", + "affinity.store", + "affinity.serif.com", + "xfinity.com", + "dfinity.org", + "ggcrypto.net", + "mycrypto.website", + "pqcrypto.org", + "z-crypto.com", + "mpcrypo.com", + "localethereum.com", + "localbitcoins.com", + "huobipro.com", + "ncrypto.tech", + "9crypto.co", + "netmask.hu", + "cryptokittens.club", + "rucrypto.com", + "cryptocities.world", + "mqtcrypto.com", + "crypto.press", + "becrypto.xyz", + "hicrypto.io", + "crypto.nl", + "zycrypto.com", + "mmcrypto.io", + "mycrypter.com", + "crypto.tickets", "crypto.pro", "ocrypto.org", "wecrypto.net", @@ -84,7 +143,6 @@ "megamas2.ru", "metamask.io", "myetherwallet.com", - "myethlerwallet.com", "ethereum.org", "myetheroll.com", "myetherapi.com", @@ -128,9 +186,249 @@ "metabase.one", "cryptokitties.co", "remme.io", - "jibrel.network" + "jibrel.network", + "twinity.com" ], "blacklist": [ + "binance-promo.net", + "trust-cryptopayment.com", + "ethereum-transfer.online", + "icotonsale.com", + "etherbonuses.com", + "ethfreeget.com", + "tongram.me", + "funfaircoin.org", + "coinbase-secure-a2k34j.bitballoon.com", + "ethereumtrans.com", + "xn--condes-8bb1661d.com", + "ethergiveawaytweet.tk", + "eth-giveaway.gq", + "nnyettiervwallat.com", + "nnyettiervwallet.com", + "eth.vote", + "eth-promo.bitballoon.com", + "ethfreepay.com", + "promo-trx.tk", + "paymentaddress.tumblr.com", + "cryptongram.org", + "campaigntoken.blogspot.de", + "coin-promos.com", + "xn--ytherwallet-iw8ex8c.com", + "smartexchangecenter.tk", + "xn--oindesk-15a.com", + "eth-transaction.secure.kissr.com", + "otoeveryday.info", + "ethfreecandy.bitballoon.com", + "etherscanio.github.io", + "ico-gram.net", + "gramtoken.network", + "ethfreegive.com", + "ether-promo.bitballoon.com", + "xn--cindesk-cx4c.com", + "theadsleader.000webhostapp.com", + "myetherwalletico.blogspot.de", + "eth-giveaway.info", + "syncfab.eu", + "eth-giveaway.com", + "icoeth.tk", + "eth-giveaway-706.htmlcomponentservice.com", + "htmlcomponentservice.com", + "mybinance.info", + "xn--myethewallet-kjc.com", + "polyswamr.io", + "polyswarm.me", + "polyswarms.io", + "eth4free.ml", + "ico-telegram-ton.com", + "telegram.tw", + "gramton.info", + "gramsap.enterprises", + "ico-telegram.club", + "telegram.one", + "etharscan.io", + "xn--coindes-jhb.com", + "blocikchair.info", + "eth-cz-319.htmlcomponentservice.com", + "xn--myetherwaet-0t8ea.com", + "eth-giveaway-514.htmlcomponentservice.com", + "xn--mtherwallet-z19ex1a.com", + "xn--eo-e9a.com", + "cosss.io", + "callistonetwork.tech", + "xn--metherwallt-819eo1a.com", + "ethfreepays.com", + "nnyettiervwailet.com", + "xn--hapehift-oh0de.com", + "gram.vc", + "bonus.etherpayout.com", + "etherpayout.com", + "ethereum-giveaway.info", + "xn--bnanc-fsax.com", + "xn--binnce-y0a.com", + "geocities.ws", + "eth-giveaway-209.statichtmlapp.com", + "binance.bitballoon.com", + "binance-give.com", + "ilil.pw", + "myetherwallet.com.send-transaction_8hlg6z8mgt6zyg.ilil.pw", + "telegram.site", + "telegram.auction", + "miroskii.com", + "eth-transactions.neocities.org", + "online-eos.org", + "data-token.org", + "eth953883.htmlcomponentservice.com", + "reeveclancy.wixsite.com", + "transfer-eth.neocities.org", + "eth.secure-transactionssecure.com", + "secure-transactionssecure.com", + "nnyiictehervvailiat.com", + "odachi.neocities.org", + "bittrex-give.com", + "policypal.info", + "changlley.org", + "rnyertherwallet.com", + "xn--thabyss-u8a.com", + "callisto-airdrop.com", + "telegramfoundation.org", + "polymathnetwork.org", + "ethereum-promo.bitballoon.com", + "dfintty.org", + "dftnity.org", + "usermd.net", + "xn--gemn-nzab.com", + "xn--bnance-3va.com", + "xn--binnce-yc8b.com", + "xn--bnance-p9a.com", + "xn--binane-0ua.com", + "binalce.com", + "binince.com", + "xn--conbase-pza.com", + "xn--conbase-sfb.com", + "xn--coinbas-xya.com", + "xn--coinbas-z8a.com", + "xn--coinbse-9wa.com", + "xn--coinbse-lwa.com", + "xn--polonex-vfb.com", + "xn--ploniex-l0a.com", + "xn--plniex-bxab.com", + "xn--havvn-9za.io", + "havvenio.com", + "nucelus.vision", + "metronometoken.io", + "meganfoxloveyou.com", + "xn--yetherwalle-iw8e1s.com", + "tron-online.org", + "myenthereumwallet.com", + "myetherwallet-team.com", + "myetherwallet.usermd.net", + "xn--yetherwalle-tv8ezt.com", + "xn--coindek-873c.com", + "dflinity.org", + "ipsx.promo", + "havven-sale.com", + "tokensale-adhive.com", + "ataritoken.ltd", + "transfer-address-confirmation.droppages.com", + "droppages.com", + "dfinlty.org", + "poloniex.work", + "tokensale-havven.in", + "ico-havven.org", + "secure.poloniex.work", + "vechain-foundation.org", + "telegram.tokyo", + "forkdelta.io", + "ton-sale.com", + "ico-telegram.online", + "telegramtoken.io", + "gonetwork-airdrop.co", + "secure-transaction-confirmation.droppages.com", + "neonexchanges.org", + "eth-transact.secure.droppages.com", + "6khb.payment-checker-ethereum-id-bslyftexjuwcgv8.filesusr.com", + "akasha-world.com", + "address-transfer-confirmation.droppages.com", + "b5z.net", + "p.b5z.net", + "tokensale.xn--havve-7l1b.com", + "xn--coindes-bx3c.com", + "xn--coindek-s73c.com", + "locaeltherum.com", + "myetherwallet.tokenimport.com", + "tokenimport.com", + "leadscoin.network", + "localethereom.com", + "havvens.win", + "xn--metherwalle-jb9ejq.com", + "xn--myetheralle-jb9exm.com", + "tefood.me", + "havventoken.com", + "havven.cc", + "havven.eu", + "havven.top", + "mywalletether.com", + "myetherwallett.site", + "xn--myethewalle-w48erh.com", + "el-petro-coin.com", + "xn--yeterwallet-bm8eym.com", + "sale-orchid.com", + "electrify-asia.info", + "tron-foundation.org", + "dflnlty.org", + "polyswarm.tech", + "tokensale.polyswarm.tech", + "polyswarm.ru", + "dock.click", + "leadcoins.network", + "dock-tokensale.eu", + "polyswarm.pw", + "dock-io.org", + "heavven.io", + "havven.live", + "havven.sale", + "havven.info", + "dock.network", + "blocklancer.me", + "tokensale-havven.io", + "havven.pro", + "tokentelegram.com", + "ico-telegram.me", + "myetherzero.com", + "seele-token.pro", + "tokensale-havven.com", + "polyswarm.in", + "sale-dock.com", + "polyswarm.co", + "polyswarm.bid", + "ton.fund", + "forkdeita.github.io", + "xn--binnce-5nf.com", + "xn--biace-4l1bb.com", + "jiocoins.io", + "xn--polonx-0va26t.com", + "myetlherewallet.org", + "myeithereiuwallet.com", + "fin-trux.com", + "finetrux.com", + "telcoin.pro", + "xn--es-8bb.com", + "xn--myetherallt-pl9elw.com", + "ico-dock.org", + "dock.io-bonus.online", + "docks.site", + "dock-ico.pro", + "dock-ico.eu", + "dock.su", + "tokensale-dock.io", + "dock-ico.site", + "openplatform.tech", + "rightmesh.in", + "waxtoken.in", + "metamaskgiveaway.xyz", + "nebulastoken.in", + "vechain-foundation.com", + "icotoken-current.top", "xn--myethrwalle-jb9e19a.com", "xn--myetheralle-7b9ezl.com", "iconfoundation.co", @@ -162,6 +460,7 @@ "sale-earn.com", "bankera.live", "originprotocol.io", + "originprotocol.online", "trx.foundation", "tokensale.adhive.net", "adhive.net", @@ -1369,6 +1668,22 @@ "ethzero-wallet.org", "zeepln.io", "wepowers.network", - "wepower.vision" + "wepower.vision", + "seele.promo", + "seele-ico.eu", + "seele-ico.pro", + "syncfab.tech", + "tokensale.syncfab.tech", + "havven.promo", + "havven-ico.com", + "havven-ico.eu", + "hawen.io", + "havven.xyz", + "tomo-coin.io", + "tomocoln.io", + "docai.science", + "tomocoin.network", + "celsius-ico.network", + "celsiuss.network" ] -} +} \ No newline at end of file From ecbb59495af61d03187e10852be610cd71c076fb Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 27 Mar 2018 13:59:54 -0700 Subject: [PATCH 02/16] Remove console.log --- test/unit/currency-controller-test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/unit/currency-controller-test.js b/test/unit/currency-controller-test.js index 63ab60f9e..73a97d120 100644 --- a/test/unit/currency-controller-test.js +++ b/test/unit/currency-controller-test.js @@ -45,7 +45,6 @@ describe('currency-controller', function () { currencyController.updateConversionRate() .then(function () { var result = currencyController.getConversionRate() - console.log('currencyController.getConversionRate:', result) assert.equal(typeof result, 'number') done() }).catch(function (err) { From f66dbec0a477aaeab1d94365bcc5cba61ce19004 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 27 Mar 2018 14:02:00 -0700 Subject: [PATCH 03/16] Metamask controller methods --- test/unit/metamask-controller-test.js | 147 +++++++++++++++++++++++++- 1 file changed, 146 insertions(+), 1 deletion(-) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index adeca9b5f..3e696a9c3 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -9,7 +9,7 @@ const firstTimeState = require('../../app/scripts/first-time-state') describe('MetaMaskController', function () { let metamaskController const sandbox = sinon.sandbox.create() - const noop = () => { } + const noop = () => {} beforeEach(function () { @@ -18,6 +18,14 @@ describe('MetaMaskController', function () { .get('/v2/blacklist') .reply(200, blacklistJSON) + nock('https://api.infura.io') + .get('/v1/ticker/ethusd') + .reply(200, '{"base": "ETH", "quote": "USD", "bid": 288.45, "ask": 288.46, "volume": 112888.17569277, "exchange": "bitfinex", "total_volume": 272175.00106721005, "num_exchanges": 8, "timestamp": 1506444677}') + + nock('https://api.infura.io') + .get('/v1/ticker/ethjpy') + .reply(200, '{"base": "ETH", "quote": "JPY", "bid": 32300.0, "ask": 32400.0, "volume": 247.4616071, "exchange": "kraken", "total_volume": 247.4616071, "num_exchanges": 1, "timestamp": 1506444676}') + nock('https://api.infura.io') .persist() .get(/.*/) @@ -46,6 +54,7 @@ describe('MetaMaskController', function () { }) describe('#getGasPrice', function () { + it('gives the 50th percentile lowest accepted gas price from recentBlocksController', async function () { const realRecentBlocksController = metamaskController.recentBlocksController metamaskController.recentBlocksController = { @@ -100,4 +109,140 @@ describe('MetaMaskController', function () { assert(metamaskController.keyringController.createNewVaultAndRestore.calledTwice) }) }) + + describe('#getApi', function () { + let getApi, state + + beforeEach(function () { + getApi = metamaskController.getApi() + }) + + it('getState', function (done) { + getApi.getState((err, res) => { + if (err) { + done(err) + } else { + state = res + } + }) + assert.deepEqual(state, metamaskController.getState()) + done() + }) + + }) + + describe('preferencesController', function () { + + it('defaults useBlockie to false', function () { + assert.equal(metamaskController.preferencesController.store.getState().useBlockie, false) + }) + + it('setUseBlockie to true', async function () { + metamaskController.setUseBlockie(true, noop) + assert.equal(metamaskController.preferencesController.store.getState().useBlockie, true) + }) + + }) + + describe('#selectFirstIdentity', function () { + let identities, address + + beforeEach(function () { + address = '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' + identities = { + identities: { + '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc': { + 'address': '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', + 'name': 'Account 1', + }, + }, + } + metamaskController.selectFirstIdentity(identities) + }) + + it('changes preferences controller select address', function () { + const preferenceControllerState = metamaskController.preferencesController.store.getState() + assert.equal(preferenceControllerState.selectedAddress, address) + }) + + it('changes metamask controller selected address', function () { + const metamaskState = metamaskController.getState() + assert.equal(metamaskState.selectedAddress, address) + }) + }) + + describe('#setCustomRpc', function () { + const customRPC = 'https://custom.rpc/' + let rpcTarget + + beforeEach(function () { + + nock('https://custom.rpc') + .post('/') + .reply(200) + + rpcTarget = metamaskController.setCustomRpc(customRPC) + }) + + it('returns custom RPC that when called', async function () { + assert.equal(await rpcTarget, customRPC) + }) + + it('changes the network controller rpc', function () { + const networkControllerState = metamaskController.networkController.store.getState() + assert.equal(networkControllerState.provider.rpcTarget, customRPC) + }) + }) + + describe('#setCurrentCurrency', function () { + let defaultMetaMaskCurrency + + beforeEach(function () { + defaultMetaMaskCurrency = metamaskController.currencyController.getCurrentCurrency() + }) + + it('defaults to usd', function () { + assert.equal(defaultMetaMaskCurrency, 'usd') + }) + + it('sets currency to JPY', function () { + metamaskController.setCurrentCurrency('JPY', noop) + assert.equal(metamaskController.currencyController.getCurrentCurrency(), 'JPY') + }) + }) + + describe('#createShapeshifttx', function () { + let depositAddress, depositType, shapeShiftTxList + beforeEach(function () { + nock('https://shapeshift.io') + .get('/txStat/3EevLFfB4H4XMWQwYCgjLie1qCAGpd2WBc') + .reply(200, '{"status": "no_deposits", "address": "3EevLFfB4H4XMWQwYCgjLie1qCAGpd2WBc"}') + + depositAddress = '3EevLFfB4H4XMWQwYCgjLie1qCAGpd2WBc' + depositType = 'ETH' + shapeShiftTxList = metamaskController.shapeshiftController.store.getState().shapeShiftTxList + }) + + it('creates', async function () { + metamaskController.createShapeShiftTx(depositAddress, depositType) + assert.equal(shapeShiftTxList[0].depositAddress, depositAddress) + }) + }) + + describe('#addNewAccount', function () { + let addNewAccount + + beforeEach(function () { + addNewAccount = metamaskController.addNewAccount() + }) + + it('errors when an primary keyring is does not exist', async function () { + try { + await addNewAccount + assert.equal(1 === 0) + } catch (e) { + assert.equal(e.message, 'MetamaskController - No HD Key Tree found') + } + }) + }) }) From 06e25205b200b976e286c670cc5e703439dab05c Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 4 Apr 2018 12:48:30 -0700 Subject: [PATCH 04/16] Update sinion methods. sandbox.create() -> createSandbox() --- test/unit/actions/tx_test.js | 2 +- test/unit/infura-controller-test.js | 2 +- test/unit/metamask-controller-test.js | 2 +- test/unit/nameForAccount_test.js | 2 +- test/unit/pending-tx-test.js | 2 +- test/unit/reducers/unlock_vault_test.js | 2 +- test/unit/util_test.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/unit/actions/tx_test.js b/test/unit/actions/tx_test.js index b6a691860..c110f71fc 100644 --- a/test/unit/actions/tx_test.js +++ b/test/unit/actions/tx_test.js @@ -9,7 +9,7 @@ var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'redu describe('tx confirmation screen', function () { beforeEach(function () { - this.sinon = sinon.sandbox.create() + this.sinon = sinon.createSandbox() }) afterEach(function () { diff --git a/test/unit/infura-controller-test.js b/test/unit/infura-controller-test.js index 605305efa..c9f0e7587 100644 --- a/test/unit/infura-controller-test.js +++ b/test/unit/infura-controller-test.js @@ -8,7 +8,7 @@ describe('infura-controller', function () { before(async function () { infuraController = new InfuraController() - sandbox = sinon.sandbox.create() + sandbox = sinon.createSandbox() sinon.stub(infuraController, 'checkInfuraNetworkStatus').resolves(response) networkStatus = await infuraController.checkInfuraNetworkStatus() }) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index 3e696a9c3..61707a759 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -8,7 +8,7 @@ const firstTimeState = require('../../app/scripts/first-time-state') describe('MetaMaskController', function () { let metamaskController - const sandbox = sinon.sandbox.create() + const sandbox = sinon.createSandbox() const noop = () => {} beforeEach(function () { diff --git a/test/unit/nameForAccount_test.js b/test/unit/nameForAccount_test.js index 32af49e9d..9bb02c6bc 100644 --- a/test/unit/nameForAccount_test.js +++ b/test/unit/nameForAccount_test.js @@ -6,7 +6,7 @@ var contractNamer = require(path.join(__dirname, '..', '..', 'old-ui', 'lib', 'c describe('contractNamer', function () { beforeEach(function () { - this.sinon = sinon.sandbox.create() + this.sinon = sinon.createSandbox() }) afterEach(function () { diff --git a/test/unit/pending-tx-test.js b/test/unit/pending-tx-test.js index f0b4e3bfc..62f4f28a8 100644 --- a/test/unit/pending-tx-test.js +++ b/test/unit/pending-tx-test.js @@ -294,7 +294,7 @@ describe('PendingTransactionTracker', function () { }) afterEach(() => { - pendingTxTracker.publishTransaction.reset() + pendingTxTracker.publishTransaction.restore() }) it('should publish the transaction', function (done) { diff --git a/test/unit/reducers/unlock_vault_test.js b/test/unit/reducers/unlock_vault_test.js index 2b7d70b2c..d66e8edbb 100644 --- a/test/unit/reducers/unlock_vault_test.js +++ b/test/unit/reducers/unlock_vault_test.js @@ -10,7 +10,7 @@ var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'redu describe('#unlockMetamask(selectedAccount)', function () { beforeEach(function () { // sinon allows stubbing methods that are easily verified - this.sinon = sinon.sandbox.create() + this.sinon = sinon.createSandbox() }) afterEach(function () { diff --git a/test/unit/util_test.js b/test/unit/util_test.js index 59048975a..39473854f 100644 --- a/test/unit/util_test.js +++ b/test/unit/util_test.js @@ -10,7 +10,7 @@ describe('util', function () { for (var i = 0; i < 18; i++) { ethInWei += '0' } beforeEach(function () { - this.sinon = sinon.sandbox.create() + this.sinon = sinon.createSandbox() }) afterEach(function () { From 7aa54916d8508aababd202eef2e57bc90c6c842d Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 4 Apr 2018 14:26:18 -0700 Subject: [PATCH 05/16] Update Sinon methods. sinon.sandbox.create() -> sandbox.createSandbox() --- test/unit/actions/tx_test.js | 2 +- test/unit/infura-controller-test.js | 2 +- test/unit/metamask-controller-test.js | 4 ++-- test/unit/nameForAccount_test.js | 2 +- test/unit/pending-tx-test.js | 2 +- test/unit/reducers/unlock_vault_test.js | 2 +- test/unit/util_test.js | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/unit/actions/tx_test.js b/test/unit/actions/tx_test.js index b6a691860..c110f71fc 100644 --- a/test/unit/actions/tx_test.js +++ b/test/unit/actions/tx_test.js @@ -9,7 +9,7 @@ var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'redu describe('tx confirmation screen', function () { beforeEach(function () { - this.sinon = sinon.sandbox.create() + this.sinon = sinon.createSandbox() }) afterEach(function () { diff --git a/test/unit/infura-controller-test.js b/test/unit/infura-controller-test.js index 605305efa..c9f0e7587 100644 --- a/test/unit/infura-controller-test.js +++ b/test/unit/infura-controller-test.js @@ -8,7 +8,7 @@ describe('infura-controller', function () { before(async function () { infuraController = new InfuraController() - sandbox = sinon.sandbox.create() + sandbox = sinon.createSandbox() sinon.stub(infuraController, 'checkInfuraNetworkStatus').resolves(response) networkStatus = await infuraController.checkInfuraNetworkStatus() }) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index 3e696a9c3..b65e9184d 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -8,7 +8,7 @@ const firstTimeState = require('../../app/scripts/first-time-state') describe('MetaMaskController', function () { let metamaskController - const sandbox = sinon.sandbox.create() + const sandbox = sinon.createSandbox() const noop = () => {} beforeEach(function () { @@ -36,7 +36,7 @@ describe('MetaMaskController', function () { encryptor: { encrypt: function (password, object) { this.object = object - return Promise.resolve() + return Promise.resolve()g }, decrypt: function () { return Promise.resolve(this.object) diff --git a/test/unit/nameForAccount_test.js b/test/unit/nameForAccount_test.js index 32af49e9d..9bb02c6bc 100644 --- a/test/unit/nameForAccount_test.js +++ b/test/unit/nameForAccount_test.js @@ -6,7 +6,7 @@ var contractNamer = require(path.join(__dirname, '..', '..', 'old-ui', 'lib', 'c describe('contractNamer', function () { beforeEach(function () { - this.sinon = sinon.sandbox.create() + this.sinon = sinon.createSandbox() }) afterEach(function () { diff --git a/test/unit/pending-tx-test.js b/test/unit/pending-tx-test.js index f0b4e3bfc..62f4f28a8 100644 --- a/test/unit/pending-tx-test.js +++ b/test/unit/pending-tx-test.js @@ -294,7 +294,7 @@ describe('PendingTransactionTracker', function () { }) afterEach(() => { - pendingTxTracker.publishTransaction.reset() + pendingTxTracker.publishTransaction.restore() }) it('should publish the transaction', function (done) { diff --git a/test/unit/reducers/unlock_vault_test.js b/test/unit/reducers/unlock_vault_test.js index 2b7d70b2c..d66e8edbb 100644 --- a/test/unit/reducers/unlock_vault_test.js +++ b/test/unit/reducers/unlock_vault_test.js @@ -10,7 +10,7 @@ var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'redu describe('#unlockMetamask(selectedAccount)', function () { beforeEach(function () { // sinon allows stubbing methods that are easily verified - this.sinon = sinon.sandbox.create() + this.sinon = sinon.createSandbox() }) afterEach(function () { diff --git a/test/unit/util_test.js b/test/unit/util_test.js index 59048975a..39473854f 100644 --- a/test/unit/util_test.js +++ b/test/unit/util_test.js @@ -10,7 +10,7 @@ describe('util', function () { for (var i = 0; i < 18; i++) { ethInWei += '0' } beforeEach(function () { - this.sinon = sinon.sandbox.create() + this.sinon = sinon.createSandbox() }) afterEach(function () { From 30474ccd35d5d7f30ffb8dff0acc8fbc77f44731 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 11 Apr 2018 08:34:35 -0700 Subject: [PATCH 06/16] MM-controlller tests --- test/unit/metamask-controller-test.js | 57 ++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index b65e9184d..454b0ae44 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -36,7 +36,7 @@ describe('MetaMaskController', function () { encryptor: { encrypt: function (password, object) { this.object = object - return Promise.resolve()g + return Promise.resolve() }, decrypt: function () { return Promise.resolve(this.object) @@ -213,6 +213,7 @@ describe('MetaMaskController', function () { describe('#createShapeshifttx', function () { let depositAddress, depositType, shapeShiftTxList + beforeEach(function () { nock('https://shapeshift.io') .get('/txStat/3EevLFfB4H4XMWQwYCgjLie1qCAGpd2WBc') @@ -223,10 +224,11 @@ describe('MetaMaskController', function () { shapeShiftTxList = metamaskController.shapeshiftController.store.getState().shapeShiftTxList }) - it('creates', async function () { + it('creates a shapeshift tx', async function () { metamaskController.createShapeShiftTx(depositAddress, depositType) assert.equal(shapeShiftTxList[0].depositAddress, depositAddress) }) + }) describe('#addNewAccount', function () { @@ -245,4 +247,55 @@ describe('MetaMaskController', function () { } }) }) + + describe('#verifyseedPhrase', function () { + let seedPhrase, getConfigSeed + + it('errors when no keying is provided', async function () { + try { + await metamaskController.verifySeedPhrase() + } catch (error) { + assert.equal(error.message, 'MetamaskController - No HD Key Tree found') + } + }) + + beforeEach(async function () { + await metamaskController.createNewVaultAndKeychain('password') + seedPhrase = await metamaskController.verifySeedPhrase() + }) + + it('#placeSeedWords should match the initially created vault seed', function () { + + metamaskController.placeSeedWords((err, result) => { + if (err) { + console.log(err) + } else { + getConfigSeed = metamaskController.configManager.getSeedWords() + assert.equal(result, seedPhrase) + assert.equal(result, getConfigSeed) + } + }) + assert.equal(getConfigSeed, undefined) + }) + }) + + describe('#clearSeedWordCache', function () { + + it('should have set seed words', function () { + metamaskController.configManager.setSeedWords('test words') + const getConfigSeed = metamaskController.configManager.getSeedWords() + assert.equal(getConfigSeed, 'test words') + }) + + it('should clear config seed phrase', function () { + metamaskController.configManager.setSeedWords('test words') + metamaskController.clearSeedWordCache((err, result) => { + if (err) console.log(err) + }) + const getConfigSeed = metamaskController.configManager.getSeedWords() + assert.equal(getConfigSeed, null) + }) + + }) + }) From 30df8b7995c61ce1ede06f9caef5c507fb678ddd Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 18 Apr 2018 11:26:49 -0700 Subject: [PATCH 07/16] newUnsignedMessage and newUnsignedPersonalMessage --- test/unit/metamask-controller-test.js | 102 ++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index 454b0ae44..52b67fdf6 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -33,6 +33,7 @@ describe('MetaMaskController', function () { metamaskController = new MetaMaskController({ showUnapprovedTx: noop, + showUnconfirmedMessage: noop, encryptor: { encrypt: function (password, object) { this.object = object @@ -298,4 +299,105 @@ describe('MetaMaskController', function () { }) + describe('#setCurrentLocale', function () { + + it('checks the default currentLocale', function () { + const preferenceCurrentLocale = metamaskController.preferencesController.store.getState().currentLocale + assert.equal(preferenceCurrentLocale, undefined) + }) + + it('sets current locale in preferences controller', function () { + metamaskController.setCurrentLocale('ja', noop) + const preferenceCurrentLocale = metamaskController.preferencesController.store.getState().currentLocale + assert.equal(preferenceCurrentLocale, 'ja') + }) + + }) + + describe('#newUnsignedMessage', function () { + + let msgParams, metamaskMsgs, messages, msgId + + const address = '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' + const data = '0x43727970746f6b697474696573' + + beforeEach(function () { + + msgParams = { + 'from': address, + 'data': data, + } + + metamaskController.newUnsignedMessage(msgParams, noop) + metamaskMsgs = metamaskController.messageManager.getUnapprovedMsgs() + messages = metamaskController.messageManager.messages + msgId = Object.keys(metamaskMsgs)[0] + }) + + it('persists address from msg params', function () { + assert.equal(metamaskMsgs[msgId].msgParams.from, address) + }) + + it('persists data from msg params', function () { + assert.equal(metamaskMsgs[msgId].msgParams.data, data) + }) + + it('sets the status to unapproved', function () { + assert.equal(metamaskMsgs[msgId].status, 'unapproved') + }) + + it('sets the type to eth_sign', function () { + assert.equal(metamaskMsgs[msgId].type, 'eth_sign') + }) + + it('rejects the message', function () { + const msgIdInt = parseInt(msgId) + metamaskController.cancelMessage(msgIdInt, noop) + assert.equal(messages[0].status, 'rejected') + }) + }) + + describe('#newUnsignedPersonalMessage', function () { + + let msgParams, metamaskMsgs, messages, msgId + + const address = '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' + const data = '0x43727970746f6b697474696573' + + beforeEach(function () { + + msgParams = { + 'from': address, + 'data': data, + } + + metamaskController.newUnsignedPersonalMessage(msgParams, noop) + metamaskMsgs = metamaskController.personalMessageManager.getUnapprovedMsgs() + messages = metamaskController.personalMessageManager.messages + msgId = Object.keys(metamaskMsgs)[0] + }) + + it('persists address from msg params', function () { + assert.equal(metamaskMsgs[msgId].msgParams.from, address) + }) + + it('persists data from msg params', function () { + assert.equal(metamaskMsgs[msgId].msgParams.data, data) + }) + + it('sets the status to unapproved', function () { + assert.equal(metamaskMsgs[msgId].status, 'unapproved') + }) + + it('sets the type to personal_sign', function () { + assert.equal(metamaskMsgs[msgId].type, 'personal_sign') + }) + + it('rejects the message', function () { + const msgIdInt = parseInt(msgId) + metamaskController.cancelPersonalMessage(msgIdInt, noop) + assert.equal(messages[0].status, 'rejected') + }) + }) + }) From 2a1912642c55fe16e180a80a0b8fa00ac13722df Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 19 Apr 2018 14:36:33 -0700 Subject: [PATCH 08/16] resetAccount and addNewAccount --- test/unit/metamask-controller-test.js | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index 52b67fdf6..63b8ecf56 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -2,13 +2,21 @@ const assert = require('assert') const sinon = require('sinon') const clone = require('clone') const nock = require('nock') +const ObservableStore = require('obs-store') const MetaMaskController = require('../../app/scripts/metamask-controller') +const TransactionController = require('../../app/scripts/controllers/transactions') const blacklistJSON = require('../stub/blacklist') const firstTimeState = require('../../app/scripts/first-time-state') +const { createTestProviderTools } = require('../stub/provider') + +const currentNetworkId = 42 describe('MetaMaskController', function () { let metamaskController const sandbox = sinon.createSandbox() + const providerResultStub = {} + const providerTools = createTestProviderTools({ scaffold: providerResultStub }) + const provider = providerTools.provider const noop = () => {} beforeEach(function () { @@ -278,6 +286,34 @@ describe('MetaMaskController', function () { }) assert.equal(getConfigSeed, undefined) }) + + it('#addNewAccount', async function () { + await metamaskController.addNewAccount() + const getAccounts = await metamaskController.keyringController.getAccounts() + assert.equal(getAccounts.length, 2) + }) + }) + + describe('#resetAccount', function () { + + beforeEach(function () { + const selectedAddressStub = sinon.stub(metamaskController.preferencesController, 'getSelectedAddress') + const getNetworkstub = sinon.stub(metamaskController.txController.txStateManager, 'getNetwork') + + selectedAddressStub.returns('0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc') + getNetworkstub.returns(42) + + metamaskController.txController.txStateManager._saveTxList([ + { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {from: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'} }, + { id: 2, status: 'rejected', metamaskNetworkId: 32, txParams: {} }, + { id: 3, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {from: '0xB09d8505E1F4EF1CeA089D47094f5DD3464083d4'} }, + ]) + }) + + it('wipes transactions from only the correct network id and with the selected address', async function () { + await metamaskController.resetAccount() + assert.equal(metamaskController.txController.txStateManager.getTx(1), undefined) + }) }) describe('#clearSeedWordCache', function () { @@ -359,6 +395,15 @@ describe('MetaMaskController', function () { describe('#newUnsignedPersonalMessage', function () { + it('errors with no from in msgParams', function () { + const msgParams = { + 'data': data, + } + metamaskController.newUnsignedPersonalMessage(msgParams, function (error) { + assert.equal(error.message, 'MetaMask Message Signature: from field is required.') + }) + }) + let msgParams, metamaskMsgs, messages, msgId const address = '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' From ddece0cc11215b323df96287f39e6758aa559f77 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 23 Apr 2018 11:21:48 -0700 Subject: [PATCH 09/16] ConfigManager markAccountsFound, markPasswordForgotten, unMarkPasswordForgotten --- test/unit/metamask-controller-test.js | 77 ++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 7 deletions(-) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index 63b8ecf56..c9d041f01 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -2,21 +2,15 @@ const assert = require('assert') const sinon = require('sinon') const clone = require('clone') const nock = require('nock') -const ObservableStore = require('obs-store') const MetaMaskController = require('../../app/scripts/metamask-controller') -const TransactionController = require('../../app/scripts/controllers/transactions') const blacklistJSON = require('../stub/blacklist') const firstTimeState = require('../../app/scripts/first-time-state') -const { createTestProviderTools } = require('../stub/provider') const currentNetworkId = 42 describe('MetaMaskController', function () { let metamaskController const sandbox = sinon.createSandbox() - const providerResultStub = {} - const providerTools = createTestProviderTools({ scaffold: providerResultStub }) - const provider = providerTools.provider const noop = () => {} beforeEach(function () { @@ -146,7 +140,7 @@ describe('MetaMaskController', function () { assert.equal(metamaskController.preferencesController.store.getState().useBlockie, false) }) - it('setUseBlockie to true', async function () { + it('setUseBlockie to true', function () { metamaskController.setUseBlockie(true, noop) assert.equal(metamaskController.preferencesController.store.getState().useBlockie, true) }) @@ -445,4 +439,73 @@ describe('MetaMaskController', function () { }) }) + describe('#approvePersonalMessage', function () { + + it('errors with no from in msgParams', function () { + const msgParams = { + 'data': data, + } + metamaskController.approvePersonalMessage(msgParams, function (error) { + assert.equal(error.message, 'MetaMask Message Signature: from field is required.') + }) + }) + + let msgParams, metamaskMsgs, msgId + + const address = '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' + const data = '0x43727970746f6b697474696573' + + beforeEach(function () { + + msgParams = { + 'from': address, + 'data': data, + } + + metamaskController.approvePersonalMessage(msgParams, noop) + metamaskMsgs = metamaskController.personalMessageManager.getUnapprovedMsgs() + msgId = Object.keys(metamaskMsgs)[0] + }) + + it('persists address from msg params', function () { + assert.equal(metamaskMsgs[msgId].msgParams.from, address) + }) + + it('persists data from msg params', function () { + assert.equal(metamaskMsgs[msgId].msgParams.data, data) + }) + + it('sets the status to unapproved', function () { + assert.equal(metamaskMsgs[msgId].status, 'unapproved') + }) + + it('sets the type to personal_sign', function () { + assert.equal(metamaskMsgs[msgId].type, 'personal_sign') + }) + }) + + describe('#markAccountsFound', function () { + it('adds lost accounts to config manager data', function () { + metamaskController.markAccountsFound(noop) + const configManagerData = metamaskController.configManager.getData() + assert.deepEqual(configManagerData.lostAccounts, []) + }) + }) + + describe('#markPasswordForgotten', function () { + it('adds and sets forgottenPassword to config data to true', function () { + metamaskController.markPasswordForgotten(noop) + const configManagerData = metamaskController.configManager.getData() + assert.equal(configManagerData.forgottenPassword, true) + }) + }) + + describe('#unMarkPasswordForgotten', function () { + it('adds and sets forgottenPassword to config data to false', function () { + metamaskController.unMarkPasswordForgotten(noop) + const configManagerData = metamaskController.configManager.getData() + assert.equal(configManagerData.forgottenPassword, false) + }) + }) + }) From 629457ea5460a1841d4682a234d6a6fb330517f9 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Apr 2018 13:33:31 -0700 Subject: [PATCH 10/16] setupUntrustedCommunication and setupTrustedCommunication --- package.json | 2 +- test/unit/metamask-controller-test.js | 45 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2c5b05547..da9f1b14d 100644 --- a/package.json +++ b/package.json @@ -181,7 +181,6 @@ "sw-controller": "^1.0.3", "sw-stream": "^2.0.2", "textarea-caret": "^3.0.1", - "through2": "^2.0.3", "valid-url": "^1.0.9", "vreme": "^3.0.2", "web3": "^0.20.1", @@ -272,6 +271,7 @@ "stylelint-config-standard": "^18.2.0", "tape": "^4.5.1", "testem": "^2.0.0", + "through2": "^2.0.3", "uglifyify": "^4.0.5", "vinyl-buffer": "^1.0.1", "vinyl-source-stream": "^2.0.0", diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index c9d041f01..acf105d4d 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -2,6 +2,7 @@ const assert = require('assert') const sinon = require('sinon') const clone = require('clone') const nock = require('nock') +const createThoughStream = require('through2').obj const MetaMaskController = require('../../app/scripts/metamask-controller') const blacklistJSON = require('../stub/blacklist') const firstTimeState = require('../../app/scripts/first-time-state') @@ -187,6 +188,10 @@ describe('MetaMaskController', function () { rpcTarget = metamaskController.setCustomRpc(customRPC) }) + afterEach(function () { + nock.cleanAll() + }) + it('returns custom RPC that when called', async function () { assert.equal(await rpcTarget, customRPC) }) @@ -484,6 +489,46 @@ describe('MetaMaskController', function () { }) }) + describe('#setupUntrustedCommunication', function () { + let streamTest + + const phishingUrl = 'decentral.market' + + afterEach(function () { + streamTest.end() + }) + + it('sets up phishing stream for untrusted communication ', async function () { + await metamaskController.blacklistController.updatePhishingList() + + streamTest = createThoughStream((chunk, enc, cb) => { + assert.equal(chunk.name, 'phishing') + assert.equal(chunk.data.hostname, phishingUrl) + cb() + }) + // console.log(streamTest) + metamaskController.setupUntrustedCommunication(streamTest, phishingUrl) + }) + }) + + describe('#setupTrustedCommunication', function () { + let streamTest + + afterEach(function () { + streamTest.end() + }) + + it('sets up controller dnode api for trusted communication', function (done) { + streamTest = createThoughStream((chunk, enc, cb) => { + assert.equal(chunk.name, 'controller') + cb() + done() + }) + + metamaskController.setupTrustedCommunication(streamTest, 'mycrypto.com') + }) + }) + describe('#markAccountsFound', function () { it('adds lost accounts to config manager data', function () { metamaskController.markAccountsFound(noop) From 6bf6589c440330d0089da4012709b831c722945a Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Apr 2018 13:38:10 -0700 Subject: [PATCH 11/16] Bump package-lock --- package-lock.json | 821 +++++++++++----------------------------------- 1 file changed, 193 insertions(+), 628 deletions(-) diff --git a/package-lock.json b/package-lock.json index e01eba370..ab72c0e6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3102,7 +3102,7 @@ "requires": { "anymatch": "1.3.2", "async-each": "1.0.1", - "fsevents": "1.1.3", + "fsevents": "1.2.2", "glob-parent": "2.0.0", "inherits": "2.0.3", "is-binary-path": "1.0.1", @@ -7561,195 +7561,75 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz", - "integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.2.tgz", + "integrity": "sha512-iownA+hC4uHFp+7gwP/y5SzaiUo7m2vpa0dhpzw8YuKtiZsz7cIXsFbXpLEeBM6WuCQyw1MH4RRe6XI8GFUctQ==", "optional": true, "requires": { - "nan": "2.8.0", - "node-pre-gyp": "0.6.39" + "nan": "2.10.0", + "node-pre-gyp": "0.9.1" }, "dependencies": { "abbrev": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", - "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=", + "version": "1.1.1", + "bundled": true, "optional": true }, - "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", - "optional": true, - "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" - } - }, "ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + "bundled": true }, "aproba": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.1.tgz", - "integrity": "sha1-ldNgDwdxCqDpKYxyatXs8urLq6s=", + "version": "1.2.0", + "bundled": true, "optional": true }, "are-we-there-yet": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", - "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", + "bundled": true, "optional": true, "requires": { "delegates": "1.0.0", - "readable-stream": "2.2.9" + "readable-stream": "2.3.6" } }, - "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "optional": true - }, - "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", - "optional": true - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "optional": true - }, - "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", - "optional": true - }, - "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", - "optional": true - }, "balanced-match": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", - "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=" - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "optional": true, - "requires": { - "tweetnacl": "0.14.5" - } - }, - "block-stream": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", - "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", - "requires": { - "inherits": "2.0.3" - } - }, - "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "requires": { - "hoek": "2.16.3" - } + "version": "1.0.0", + "bundled": true }, "brace-expansion": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", - "integrity": "sha1-Pv/DxQ4ABTH7cg6v+A8K6O8jz1k=", + "version": "1.1.11", + "bundled": true, "requires": { - "balanced-match": "0.4.2", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, - "buffer-shims": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", - "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=" - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "optional": true - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "chownr": { + "version": "1.0.1", + "bundled": true, "optional": true }, "code-point-at": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" - }, - "combined-stream": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", - "requires": { - "delayed-stream": "1.0.0" - } + "bundled": true }, "concat-map": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + "bundled": true }, "core-util-is": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "requires": { - "boom": "2.10.1" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "optional": true, - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "optional": true - } - } + "bundled": true, + "optional": true }, "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "version": "2.6.9", + "bundled": true, "optional": true, "requires": { "ms": "2.0.0" @@ -7757,98 +7637,38 @@ }, "deep-extend": { "version": "0.4.2", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", - "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "bundled": true, "optional": true }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, "delegates": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "bundled": true, "optional": true }, "detect-libc": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.2.tgz", - "integrity": "sha1-ca1dIEvxempsqPRQxhRUBm70YeE=", + "version": "1.0.3", + "bundled": true, "optional": true }, - "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "fs-minipass": { + "version": "1.2.5", + "bundled": true, "optional": true, "requires": { - "jsbn": "0.1.1" - } - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", - "optional": true - }, - "extsprintf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", - "integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA=" - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "optional": true - }, - "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", - "optional": true, - "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.15" + "minipass": "2.2.4" } }, "fs.realpath": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "fstream": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", - "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", - "requires": { - "graceful-fs": "4.1.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.6.1" - } - }, - "fstream-ignore": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.5.tgz", - "integrity": "sha1-nDHa40dnAY/h0kmyTa2mfQktoQU=", - "optional": true, - "requires": { - "fstream": "1.0.11", - "inherits": "2.0.3", - "minimatch": "3.0.4" - } + "bundled": true, + "optional": true }, "gauge": { "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "bundled": true, "optional": true, "requires": { - "aproba": "1.1.1", + "aproba": "1.2.0", "console-control-strings": "1.1.0", "has-unicode": "2.0.1", "object-assign": "4.1.1", @@ -7858,27 +7678,10 @@ "wide-align": "1.1.2" } }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "optional": true, - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "optional": true - } - } - }, "glob": { "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "bundled": true, + "optional": true, "requires": { "fs.realpath": "1.0.0", "inflight": "1.0.6", @@ -7888,64 +7691,31 @@ "path-is-absolute": "1.0.1" } }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" - }, - "har-schema": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", - "optional": true - }, - "har-validator": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", - "optional": true, - "requires": { - "ajv": "4.11.8", - "har-schema": "1.0.5" - } - }, "has-unicode": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "bundled": true, "optional": true }, - "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" - } - }, - "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" - }, - "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "iconv-lite": { + "version": "0.4.21", + "bundled": true, "optional": true, "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.0", - "sshpk": "1.13.0" + "safer-buffer": "2.1.2" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "optional": true, + "requires": { + "minimatch": "3.0.4" } }, "inflight": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "bundled": true, + "optional": true, "requires": { "once": "1.4.0", "wrappy": "1.0.2" @@ -7953,175 +7723,123 @@ }, "inherits": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "bundled": true }, "ini": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", - "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", + "version": "1.3.5", + "bundled": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "bundled": true, "requires": { "number-is-nan": "1.0.1" } }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "optional": true - }, "isarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "bundled": true, "optional": true }, - "jodid25519": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz", - "integrity": "sha1-BtSRIlUJNBlHfUJWM2BuDpB4KWc=", - "optional": true, - "requires": { - "jsbn": "0.1.1" - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "optional": true - }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "optional": true, - "requires": { - "jsonify": "0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "optional": true - }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "optional": true - }, - "jsprim": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz", - "integrity": "sha1-o7h+QCmNjDgFUtjMdiigu5WiKRg=", - "optional": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.0.2", - "json-schema": "0.2.3", - "verror": "1.3.6" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "optional": true - } - } - }, - "mime-db": { - "version": "1.27.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz", - "integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE=" - }, - "mime-types": { - "version": "2.1.15", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz", - "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=", - "requires": { - "mime-db": "1.27.0" - } - }, "minimatch": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "bundled": true, "requires": { - "brace-expansion": "1.1.7" + "brace-expansion": "1.1.11" } }, "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "bundled": true + }, + "minipass": { + "version": "2.2.4", + "bundled": true, + "requires": { + "safe-buffer": "5.1.1", + "yallist": "3.0.2" + } + }, + "minizlib": { + "version": "1.1.0", + "bundled": true, + "optional": true, + "requires": { + "minipass": "2.2.4" + } }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "bundled": true, "requires": { "minimist": "0.0.8" } }, "ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "bundled": true, "optional": true }, - "node-pre-gyp": { - "version": "0.6.39", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.39.tgz", - "integrity": "sha512-OsJV74qxnvz/AMGgcfZoDaeDXKD3oY3QVIbBmwszTFkRisTSXbMQyn4UWzUMOtA5SVhrBZOTp0wcoSBgfMfMmQ==", + "nan": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "optional": true + }, + "needle": { + "version": "2.2.0", + "bundled": true, "optional": true, "requires": { - "detect-libc": "1.0.2", - "hawk": "3.1.3", + "debug": "2.6.9", + "iconv-lite": "0.4.21", + "sax": "1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.9.1", + "bundled": true, + "optional": true, + "requires": { + "detect-libc": "1.0.3", "mkdirp": "0.5.1", + "needle": "2.2.0", "nopt": "4.0.1", - "npmlog": "4.1.0", - "rc": "1.2.1", - "request": "2.81.0", - "rimraf": "2.6.1", - "semver": "5.3.0", - "tar": "2.2.1", - "tar-pack": "3.4.0" + "npm-packlist": "1.1.10", + "npmlog": "4.1.2", + "rc": "1.2.6", + "rimraf": "2.6.2", + "semver": "5.5.0", + "tar": "4.4.1" } }, "nopt": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", - "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "bundled": true, "optional": true, "requires": { - "abbrev": "1.1.0", - "osenv": "0.1.4" + "abbrev": "1.1.1", + "osenv": "0.1.5" + } + }, + "npm-bundled": { + "version": "1.0.3", + "bundled": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.10", + "bundled": true, + "optional": true, + "requires": { + "ignore-walk": "3.0.1", + "npm-bundled": "1.0.3" } }, "npmlog": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.0.tgz", - "integrity": "sha512-ocolIkZYZt8UveuiDS0yAkkIjid1o7lPG8cYm05yNYzBn8ykQtaiPMEGp8fY9tKdDgm8okpdKzkvu1y9hUYugA==", + "version": "4.1.2", + "bundled": true, "optional": true, "requires": { "are-we-there-yet": "1.1.4", @@ -8132,45 +7850,33 @@ }, "number-is-nan": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "bundled": true, "optional": true }, "once": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "bundled": true, "requires": { "wrappy": "1.0.2" } }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "bundled": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "bundled": true, "optional": true }, "osenv": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", - "integrity": "sha1-Qv5tWVPfBsgGS+bxdsPQWqqjRkQ=", + "version": "0.1.5", + "bundled": true, "optional": true, "requires": { "os-homedir": "1.0.2", @@ -8179,164 +7885,86 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "performance-now": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", + "bundled": true, "optional": true }, "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "optional": true - }, - "qs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", - "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", + "version": "2.0.0", + "bundled": true, "optional": true }, "rc": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", - "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", + "version": "1.2.6", + "bundled": true, "optional": true, "requires": { "deep-extend": "0.4.2", - "ini": "1.3.4", + "ini": "1.3.5", "minimist": "1.2.0", "strip-json-comments": "2.0.1" }, "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "bundled": true, "optional": true } } }, "readable-stream": { - "version": "2.2.9", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", - "integrity": "sha1-z3jsb0ptHrQ9JkiMrJfwQudLf8g=", + "version": "2.3.6", + "bundled": true, + "optional": true, "requires": { - "buffer-shims": "1.0.0", "core-util-is": "1.0.2", "inherits": "2.0.3", "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "1.0.1", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.1.1", "util-deprecate": "1.0.2" } }, - "request": { - "version": "2.81.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", - "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", - "optional": true, - "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "4.2.1", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.15", - "oauth-sign": "0.8.2", - "performance-now": "0.2.0", - "qs": "6.4.0", - "safe-buffer": "5.0.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.2", - "tunnel-agent": "0.6.0", - "uuid": "3.0.1" - } - }, "rimraf": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", - "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", + "version": "2.6.2", + "bundled": true, + "optional": true, "requires": { "glob": "7.1.2" } }, "safe-buffer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.0.1.tgz", - "integrity": "sha1-0mPKVGls2KMGtcplUekt5XkY++c=" + "version": "5.1.1", + "bundled": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "optional": true }, "semver": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "version": "5.5.0", + "bundled": true, "optional": true }, "set-blocking": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "bundled": true, "optional": true }, "signal-exit": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "bundled": true, "optional": true }, - "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "requires": { - "hoek": "2.16.3" - } - }, - "sshpk": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.0.tgz", - "integrity": "sha1-/yo+T9BEl1Vf7Zezmg/YL6+zozw=", - "optional": true, - "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jodid25519": "1.0.2", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "optional": true - } - } - }, "string-width": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "bundled": true, "requires": { "code-point-at": "1.1.0", "is-fullwidth-code-point": "1.0.0", @@ -8344,113 +7972,47 @@ } }, "string_decoder": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz", - "integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=", + "version": "1.1.1", + "bundled": true, + "optional": true, "requires": { - "safe-buffer": "5.0.1" + "safe-buffer": "5.1.1" } }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", - "optional": true - }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "bundled": true, "requires": { "ansi-regex": "2.1.1" } }, "strip-json-comments": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "bundled": true, "optional": true }, "tar": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", - "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", - "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" - } - }, - "tar-pack": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/tar-pack/-/tar-pack-3.4.0.tgz", - "integrity": "sha1-I74tf2cagzk3bL2wuP4/3r8xeYQ=", + "version": "4.4.1", + "bundled": true, "optional": true, "requires": { - "debug": "2.6.8", - "fstream": "1.0.11", - "fstream-ignore": "1.0.5", - "once": "1.4.0", - "readable-stream": "2.2.9", - "rimraf": "2.6.1", - "tar": "2.2.1", - "uid-number": "0.0.6" + "chownr": "1.0.1", + "fs-minipass": "1.2.5", + "minipass": "2.2.4", + "minizlib": "1.1.0", + "mkdirp": "0.5.1", + "safe-buffer": "5.1.1", + "yallist": "3.0.2" } }, - "tough-cookie": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", - "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", - "optional": true, - "requires": { - "punycode": "1.4.1" - } - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "optional": true, - "requires": { - "safe-buffer": "5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true - }, - "uid-number": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/uid-number/-/uid-number-0.0.6.tgz", - "integrity": "sha1-DqEOgDXo61uOREnwbaHHMGY7qoE=", - "optional": true - }, "util-deprecate": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "uuid": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz", - "integrity": "sha1-ZUS7ot/ajBzxfmKaOjBeK7H+5sE=", + "bundled": true, "optional": true }, - "verror": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz", - "integrity": "sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw=", - "optional": true, - "requires": { - "extsprintf": "1.0.2" - } - }, "wide-align": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", - "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", + "bundled": true, "optional": true, "requires": { "string-width": "1.0.2" @@ -8458,8 +8020,11 @@ }, "wrappy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "bundled": true + }, + "yallist": { + "version": "3.0.2", + "bundled": true } } }, @@ -10187,7 +9752,7 @@ "anymatch": "2.0.0", "async-each": "1.0.1", "braces": "2.3.1", - "fsevents": "1.1.3", + "fsevents": "1.2.2", "glob-parent": "3.1.0", "inherits": "2.0.3", "is-binary-path": "1.0.1", @@ -19533,7 +19098,7 @@ "requires": { "anymatch": "1.3.2", "async-each": "1.0.1", - "fsevents": "1.1.3", + "fsevents": "1.2.2", "glob-parent": "2.0.0", "inherits": "2.0.3", "is-binary-path": "1.0.1", From f2e1cb9302320c9abf2814bfdaea98aee7add92e Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 7 May 2018 14:56:33 -0700 Subject: [PATCH 12/16] Remove approvePersonalMessage test --- test/unit/metamask-controller-test.js | 45 --------------------------- 1 file changed, 45 deletions(-) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index ae9f549ad..332ccfdb8 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -460,51 +460,6 @@ describe('MetaMaskController', function () { }) }) - describe('#approvePersonalMessage', function () { - - it('errors with no from in msgParams', function () { - const msgParams = { - 'data': data, - } - metamaskController.approvePersonalMessage(msgParams, function (error) { - assert.equal(error.message, 'MetaMask Message Signature: from field is required.') - }) - }) - - let msgParams, metamaskMsgs, msgId - - const address = '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' - const data = '0x43727970746f6b697474696573' - - beforeEach(function () { - - msgParams = { - 'from': address, - 'data': data, - } - - metamaskController.approvePersonalMessage(msgParams, noop) - metamaskMsgs = metamaskController.personalMessageManager.getUnapprovedMsgs() - msgId = Object.keys(metamaskMsgs)[0] - }) - - it('persists address from msg params', function () { - assert.equal(metamaskMsgs[msgId].msgParams.from, address) - }) - - it('persists data from msg params', function () { - assert.equal(metamaskMsgs[msgId].msgParams.data, data) - }) - - it('sets the status to unapproved', function () { - assert.equal(metamaskMsgs[msgId].status, 'unapproved') - }) - - it('sets the type to personal_sign', function () { - assert.equal(metamaskMsgs[msgId].type, 'personal_sign') - }) - }) - describe('#setupUntrustedCommunication', function () { let streamTest From 9a1661918f19a258c22d2c61b7ea972f9640667d Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 9 May 2018 01:51:55 -0700 Subject: [PATCH 13/16] ImportAccountWithStrategies Json and Keystore --- test/unit/account-import-strategies.spec.js | 30 +++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/unit/account-import-strategies.spec.js diff --git a/test/unit/account-import-strategies.spec.js b/test/unit/account-import-strategies.spec.js new file mode 100644 index 000000000..e0417299a --- /dev/null +++ b/test/unit/account-import-strategies.spec.js @@ -0,0 +1,30 @@ +const assert = require('assert') +const accountImporter = require('../../app/scripts/account-import-strategies/index') +const ethUtil = require('ethereumjs-util') + +describe('Account Import Strategies', function () { + const privkey = '0x4cfd3e90fc78b0f86bf7524722150bb8da9c60cd532564d7ff43f5716514f553' + const json = '{"version":3,"id":"dbb54385-0a99-437f-83c0-647de9f244c3","address":"a7f92ce3fba24196cf6f4bd2e1eb3db282ba998c","Crypto":{"ciphertext":"bde13d9ade5c82df80281ca363320ce254a8a3a06535bbf6ffdeaf0726b1312c","cipherparams":{"iv":"fbf93718a57f26051b292f072f2e5b41"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"7ffe00488319dec48e4c49a120ca49c6afbde9272854c64d9541c83fc6acdffe","n":8192,"r":8,"p":1},"mac":"2adfd9c4bc1cdac4c85bddfb31d9e21a684e0e050247a70c5698facf6b7d4681"}}' + + it('imports a private key and strips 0x prefix', async function () { + const importPrivKey = await accountImporter.importAccount('Private Key', [ privkey ]) + assert.equal(importPrivKey, ethUtil.stripHexPrefix(privkey)) + }) + + it('fails when password is incorrect for keystore', async function () { + const wrongPassword = 'password2' + + try { + await accountImporter.importAccount('JSON File', [ json, wrongPassword]) + } catch (error) { + assert.equal(error.message, 'Key derivation failed - possibly wrong passphrase') + } + }) + + it('imports json string and password to return a private key', async function () { + const fileContentsPassword = 'password1' + const importJson = await accountImporter.importAccount('JSON File', [ json, fileContentsPassword]) + console.log(importJson) + }) + +}) From f441153211c7920573f8bfb699bfda1b6de7efe9 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 9 May 2018 01:58:43 -0700 Subject: [PATCH 14/16] console.log -> assert.equal --- test/unit/account-import-strategies.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/account-import-strategies.spec.js b/test/unit/account-import-strategies.spec.js index e0417299a..acc39c88c 100644 --- a/test/unit/account-import-strategies.spec.js +++ b/test/unit/account-import-strategies.spec.js @@ -24,7 +24,7 @@ describe('Account Import Strategies', function () { it('imports json string and password to return a private key', async function () { const fileContentsPassword = 'password1' const importJson = await accountImporter.importAccount('JSON File', [ json, fileContentsPassword]) - console.log(importJson) + assert.equal(importJson, '0x5733876abe94146069ce8bcbabbde2677f2e35fa33e875e92041ed2ac87e5bc7') }) }) From f279a8e61a3f50326fe9f26b0b860af47cd662fb Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 17 May 2018 16:26:08 -0700 Subject: [PATCH 15/16] signMessage and signPersonalMessage --- test/unit/metamask-controller-test.js | 46 +++++++++++++++++++-------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index 332ccfdb8..23372d823 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -369,10 +369,12 @@ describe('MetaMaskController', function () { let msgParams, metamaskMsgs, messages, msgId - const address = '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' + const address = '0xc42edfcc21ed14dda456aa0756c153f7985d8813' const data = '0x43727970746f6b697474696573' - beforeEach(function () { + beforeEach(async function () { + + await metamaskController.createNewVaultAndRestore('foobar1337', TEST_SEED_ALT) msgParams = { 'from': address, @@ -383,6 +385,7 @@ describe('MetaMaskController', function () { metamaskMsgs = metamaskController.messageManager.getUnapprovedMsgs() messages = metamaskController.messageManager.messages msgId = Object.keys(metamaskMsgs)[0] + messages[0].msgParams.metamaskId = parseInt(msgId) }) it('persists address from msg params', function () { @@ -406,6 +409,14 @@ describe('MetaMaskController', function () { metamaskController.cancelMessage(msgIdInt, noop) assert.equal(messages[0].status, 'rejected') }) + + it('errors when signing a message', async function () { + try { + await metamaskController.signMessage(messages[0].msgParams) + } catch (error) { + assert.equal(error.message, 'message length is invalid') + } + }) }) describe('#newUnsignedPersonalMessage', function () { @@ -419,12 +430,14 @@ describe('MetaMaskController', function () { }) }) - let msgParams, metamaskMsgs, messages, msgId + let msgParams, metamaskPersonalMsgs, personalMessages, msgId - const address = '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' + const address = '0xc42edfcc21ed14dda456aa0756c153f7985d8813' const data = '0x43727970746f6b697474696573' - beforeEach(function () { + beforeEach(async function () { + + await metamaskController.createNewVaultAndRestore('foobar1337', TEST_SEED_ALT) msgParams = { 'from': address, @@ -432,31 +445,38 @@ describe('MetaMaskController', function () { } metamaskController.newUnsignedPersonalMessage(msgParams, noop) - metamaskMsgs = metamaskController.personalMessageManager.getUnapprovedMsgs() - messages = metamaskController.personalMessageManager.messages - msgId = Object.keys(metamaskMsgs)[0] + metamaskPersonalMsgs = metamaskController.personalMessageManager.getUnapprovedMsgs() + personalMessages = metamaskController.personalMessageManager.messages + msgId = Object.keys(metamaskPersonalMsgs)[0] + personalMessages[0].msgParams.metamaskId = parseInt(msgId) }) it('persists address from msg params', function () { - assert.equal(metamaskMsgs[msgId].msgParams.from, address) + assert.equal(metamaskPersonalMsgs[msgId].msgParams.from, address) }) it('persists data from msg params', function () { - assert.equal(metamaskMsgs[msgId].msgParams.data, data) + assert.equal(metamaskPersonalMsgs[msgId].msgParams.data, data) }) it('sets the status to unapproved', function () { - assert.equal(metamaskMsgs[msgId].status, 'unapproved') + assert.equal(metamaskPersonalMsgs[msgId].status, 'unapproved') }) it('sets the type to personal_sign', function () { - assert.equal(metamaskMsgs[msgId].type, 'personal_sign') + assert.equal(metamaskPersonalMsgs[msgId].type, 'personal_sign') }) it('rejects the message', function () { const msgIdInt = parseInt(msgId) metamaskController.cancelPersonalMessage(msgIdInt, noop) - assert.equal(messages[0].status, 'rejected') + assert.equal(personalMessages[0].status, 'rejected') + }) + + it('errors when signing a message', async function () { + await metamaskController.signPersonalMessage(personalMessages[0].msgParams) + assert.equal(metamaskPersonalMsgs[msgId].status, 'signed') + assert.equal(metamaskPersonalMsgs[msgId].rawSig, '0x6a1b65e2b8ed53cf398a769fad24738f9fbe29841fe6854e226953542c4b6a173473cb152b6b1ae5f06d601d45dd699a129b0a8ca84e78b423031db5baa734741b') }) }) From 13ebb0b455bc775a53b6bb30e675a39d02d8f6f5 Mon Sep 17 00:00:00 2001 From: tmashuang Date: Mon, 21 May 2018 05:59:26 -0700 Subject: [PATCH 16/16] Moved loose some loose test files to sub folders --- .../{ => app}/ComposableObservableStore.js | 2 +- .../account-import-strategies.spec.js | 3 +- test/unit/app/buy-eth-url.spec.js | 48 +++++++++++++++++++ .../controllers}/address-book-controller.js | 2 +- .../controllers}/blacklist-controller-test.js | 2 +- .../controllers}/currency-controller-test.js | 2 +- .../controllers}/infura-controller-test.js | 2 +- .../controllers}/metamask-controller-test.js | 6 +-- .../controllers}/network-contoller-test.js | 6 +-- .../controllers}/notice-controller-test.js | 4 +- .../preferences-controller-test.js | 2 +- .../controllers}/token-rates-controller.js | 2 +- .../transactions}/nonce-tracker-test.js | 4 +- .../transactions}/pending-tx-test.js | 6 +-- .../transactions}/tx-controller-test.js | 6 +-- .../transactions}/tx-gas-util-test.js | 4 +- .../transactions}/tx-helper-test.js | 2 +- .../tx-state-history-helper-test.js | 4 +- .../transactions}/tx-state-manager-test.js | 4 +- .../transactions}/tx-utils-test.js | 2 +- test/unit/{ => app}/edge-encryptor-test.js | 2 +- test/unit/{ => app}/message-manager-test.js | 2 +- test/unit/{ => app}/nodeify-test.js | 2 +- test/unit/{ => app}/pending-balance-test.js | 4 +- .../personal-message-manager-test.js | 2 +- .../{ => app}/seed-phrase-verifier-test.js | 6 +-- test/unit/{ => app}/util-test.js | 2 +- test/unit/{ => migrations}/migrations-test.js | 28 +++++------ test/unit/{ => migrations}/migrator-test.js | 6 +-- 29 files changed, 108 insertions(+), 59 deletions(-) rename test/unit/{ => app}/ComposableObservableStore.js (92%) rename test/unit/{ => app}/account-import-strategies.spec.js (93%) create mode 100644 test/unit/app/buy-eth-url.spec.js rename test/unit/{ => app/controllers}/address-book-controller.js (95%) rename test/unit/{ => app/controllers}/blacklist-controller-test.js (94%) rename test/unit/{ => app/controllers}/currency-controller-test.js (97%) rename test/unit/{ => app/controllers}/infura-controller-test.js (95%) rename test/unit/{ => app/controllers}/metamask-controller-test.js (98%) rename test/unit/{ => app/controllers}/network-contoller-test.js (92%) rename test/unit/{ => app/controllers}/notice-controller-test.js (96%) rename test/unit/{ => app/controllers}/preferences-controller-test.js (94%) rename test/unit/{ => app/controllers}/token-rates-controller.js (92%) rename test/unit/{ => app/controllers/transactions}/nonce-tracker-test.js (98%) rename test/unit/{ => app/controllers/transactions}/pending-tx-test.js (98%) rename test/unit/{ => app/controllers/transactions}/tx-controller-test.js (98%) rename test/unit/{ => app/controllers/transactions}/tx-gas-util-test.js (93%) rename test/unit/{ => app/controllers/transactions}/tx-helper-test.js (88%) rename test/unit/{ => app/controllers/transactions}/tx-state-history-helper-test.js (95%) rename test/unit/{ => app/controllers/transactions}/tx-state-manager-test.js (98%) rename test/unit/{ => app/controllers/transactions}/tx-utils-test.js (97%) rename test/unit/{ => app}/edge-encryptor-test.js (97%) rename test/unit/{ => app}/message-manager-test.js (97%) rename test/unit/{ => app}/nodeify-test.js (92%) rename test/unit/{ => app}/pending-balance-test.js (94%) rename test/unit/{ => app}/personal-message-manager-test.js (97%) rename test/unit/{ => app}/seed-phrase-verifier-test.js (95%) rename test/unit/{ => app}/util-test.js (93%) rename test/unit/{ => migrations}/migrations-test.js (81%) rename test/unit/{ => migrations}/migrator-test.js (90%) diff --git a/test/unit/ComposableObservableStore.js b/test/unit/app/ComposableObservableStore.js similarity index 92% rename from test/unit/ComposableObservableStore.js rename to test/unit/app/ComposableObservableStore.js index 3fba200c1..aa8abd463 100644 --- a/test/unit/ComposableObservableStore.js +++ b/test/unit/app/ComposableObservableStore.js @@ -1,5 +1,5 @@ const assert = require('assert') -const ComposableObservableStore = require('../../app/scripts/lib/ComposableObservableStore') +const ComposableObservableStore = require('../../../app/scripts/lib/ComposableObservableStore') const ObservableStore = require('obs-store') describe('ComposableObservableStore', () => { diff --git a/test/unit/account-import-strategies.spec.js b/test/unit/app/account-import-strategies.spec.js similarity index 93% rename from test/unit/account-import-strategies.spec.js rename to test/unit/app/account-import-strategies.spec.js index acc39c88c..83cfaeb3e 100644 --- a/test/unit/account-import-strategies.spec.js +++ b/test/unit/app/account-import-strategies.spec.js @@ -1,5 +1,6 @@ const assert = require('assert') -const accountImporter = require('../../app/scripts/account-import-strategies/index') +const path = require('path') +const accountImporter = require('../../../app/scripts/account-import-strategies/index') const ethUtil = require('ethereumjs-util') describe('Account Import Strategies', function () { diff --git a/test/unit/app/buy-eth-url.spec.js b/test/unit/app/buy-eth-url.spec.js new file mode 100644 index 000000000..36646fa68 --- /dev/null +++ b/test/unit/app/buy-eth-url.spec.js @@ -0,0 +1,48 @@ +const assert = require('assert') +const getBuyEthUrl = require('../../../app/scripts/lib/buy-eth-url') + +describe('', function () { + const mainnet = { + network: '1', + amount: 5, + address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', + } + const ropsten = { + network: '3', + } + const rinkeby = { + network: '4', + } + const kovan = { + network: '42', + } + + it('returns coinbase url with amount and address for network 1', function () { + const coinbaseUrl = getBuyEthUrl(mainnet) + const coinbase = coinbaseUrl.match(/(https:\/\/buy.coinbase.com)/) + const amount = coinbaseUrl.match(/(amount)\D\d/) + const address = coinbaseUrl.match(/(address)(.*)(?=&)/) + + assert.equal(coinbase[0], 'https://buy.coinbase.com') + assert.equal(amount[0], 'amount=5') + assert.equal(address[0], 'address=0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc') + + }) + + it('returns metamask ropsten faucet for network 3', function () { + const ropstenUrl = getBuyEthUrl(ropsten) + assert.equal(ropstenUrl, 'https://faucet.metamask.io/') + }) + + it('returns rinkeby dapp for network 4', function () { + const rinkebyUrl = getBuyEthUrl(rinkeby) + assert.equal(rinkebyUrl, 'https://www.rinkeby.io/') + }) + + it('returns kovan github test faucet for network 42', function () { + const kovanUrl = getBuyEthUrl(kovan) + assert.equal(kovanUrl, 'https://github.com/kovan-testnet/faucet') + }) + +}) + diff --git a/test/unit/address-book-controller.js b/test/unit/app/controllers/address-book-controller.js similarity index 95% rename from test/unit/address-book-controller.js rename to test/unit/app/controllers/address-book-controller.js index 655c9022c..1836dea94 100644 --- a/test/unit/address-book-controller.js +++ b/test/unit/app/controllers/address-book-controller.js @@ -1,5 +1,5 @@ const assert = require('assert') -const AddressBookController = require('../../app/scripts/controllers/address-book') +const AddressBookController = require('../../../../app/scripts/controllers/address-book') const mockKeyringController = { memStore: { diff --git a/test/unit/blacklist-controller-test.js b/test/unit/app/controllers/blacklist-controller-test.js similarity index 94% rename from test/unit/blacklist-controller-test.js rename to test/unit/app/controllers/blacklist-controller-test.js index cbf73d3e5..085641777 100644 --- a/test/unit/blacklist-controller-test.js +++ b/test/unit/app/controllers/blacklist-controller-test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const BlacklistController = require('../../app/scripts/controllers/blacklist') +const BlacklistController = require('../../../../app/scripts/controllers/blacklist') describe('blacklist controller', function () { let blacklistController diff --git a/test/unit/currency-controller-test.js b/test/unit/app/controllers/currency-controller-test.js similarity index 97% rename from test/unit/currency-controller-test.js rename to test/unit/app/controllers/currency-controller-test.js index 73a97d120..1941d1c43 100644 --- a/test/unit/currency-controller-test.js +++ b/test/unit/app/controllers/currency-controller-test.js @@ -3,7 +3,7 @@ global.fetch = global.fetch || require('isomorphic-fetch') const assert = require('assert') const nock = require('nock') -const CurrencyController = require('../../app/scripts/controllers/currency') +const CurrencyController = require('../../../../app/scripts/controllers/currency') describe('currency-controller', function () { var currencyController diff --git a/test/unit/infura-controller-test.js b/test/unit/app/controllers/infura-controller-test.js similarity index 95% rename from test/unit/infura-controller-test.js rename to test/unit/app/controllers/infura-controller-test.js index c9f0e7587..7bd95dd4b 100644 --- a/test/unit/infura-controller-test.js +++ b/test/unit/app/controllers/infura-controller-test.js @@ -1,6 +1,6 @@ const assert = require('assert') const sinon = require('sinon') -const InfuraController = require('../../app/scripts/controllers/infura') +const InfuraController = require('../../../../app/scripts/controllers/infura') describe('infura-controller', function () { let infuraController, sandbox, networkStatus diff --git a/test/unit/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js similarity index 98% rename from test/unit/metamask-controller-test.js rename to test/unit/app/controllers/metamask-controller-test.js index 23372d823..65a6fea09 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/app/controllers/metamask-controller-test.js @@ -3,9 +3,9 @@ const sinon = require('sinon') const clone = require('clone') const nock = require('nock') const createThoughStream = require('through2').obj -const MetaMaskController = require('../../app/scripts/metamask-controller') -const blacklistJSON = require('../stub/blacklist') -const firstTimeState = require('../../app/scripts/first-time-state') +const MetaMaskController = require('../../../../app/scripts/metamask-controller') +const blacklistJSON = require('../../../stub/blacklist') +const firstTimeState = require('../../../../app/scripts/first-time-state') const currentNetworkId = 42 const DEFAULT_LABEL = 'Account 1' diff --git a/test/unit/network-contoller-test.js b/test/unit/app/controllers/network-contoller-test.js similarity index 92% rename from test/unit/network-contoller-test.js rename to test/unit/app/controllers/network-contoller-test.js index 2d590a3f6..789850ef3 100644 --- a/test/unit/network-contoller-test.js +++ b/test/unit/app/controllers/network-contoller-test.js @@ -1,11 +1,11 @@ const assert = require('assert') const nock = require('nock') -const NetworkController = require('../../app/scripts/controllers/network') +const NetworkController = require('../../../../app/scripts/controllers/network') const { getNetworkDisplayName, -} = require('../../app/scripts/controllers/network/util') +} = require('../../../../app/scripts/controllers/network/util') -const { createTestProviderTools } = require('../stub/provider') +const { createTestProviderTools } = require('../../../stub/provider') const providerResultStub = {} describe('# Network Controller', function () { diff --git a/test/unit/notice-controller-test.js b/test/unit/app/controllers/notice-controller-test.js similarity index 96% rename from test/unit/notice-controller-test.js rename to test/unit/app/controllers/notice-controller-test.js index 09eeda15c..e78b69623 100644 --- a/test/unit/notice-controller-test.js +++ b/test/unit/app/controllers/notice-controller-test.js @@ -1,6 +1,6 @@ const assert = require('assert') -const configManagerGen = require('../lib/mock-config-manager') -const NoticeController = require('../../app/scripts/notice-controller') +const configManagerGen = require('../../../lib/mock-config-manager') +const NoticeController = require('../../../../app/scripts/notice-controller') describe('notice-controller', function () { var noticeController diff --git a/test/unit/preferences-controller-test.js b/test/unit/app/controllers/preferences-controller-test.js similarity index 94% rename from test/unit/preferences-controller-test.js rename to test/unit/app/controllers/preferences-controller-test.js index 9fb5e4251..3d903bd5b 100644 --- a/test/unit/preferences-controller-test.js +++ b/test/unit/app/controllers/preferences-controller-test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const PreferencesController = require('../../app/scripts/controllers/preferences') +const PreferencesController = require('../../../../app/scripts/controllers/preferences') describe('preferences controller', function () { let preferencesController diff --git a/test/unit/token-rates-controller.js b/test/unit/app/controllers/token-rates-controller.js similarity index 92% rename from test/unit/token-rates-controller.js rename to test/unit/app/controllers/token-rates-controller.js index a49547313..28e583d8d 100644 --- a/test/unit/token-rates-controller.js +++ b/test/unit/app/controllers/token-rates-controller.js @@ -1,6 +1,6 @@ const assert = require('assert') const sinon = require('sinon') -const TokenRatesController = require('../../app/scripts/controllers/token-rates') +const TokenRatesController = require('../../../../app/scripts/controllers/token-rates') const ObservableStore = require('obs-store') describe('TokenRatesController', () => { diff --git a/test/unit/nonce-tracker-test.js b/test/unit/app/controllers/transactions/nonce-tracker-test.js similarity index 98% rename from test/unit/nonce-tracker-test.js rename to test/unit/app/controllers/transactions/nonce-tracker-test.js index cf26945d3..fc852458c 100644 --- a/test/unit/nonce-tracker-test.js +++ b/test/unit/app/controllers/transactions/nonce-tracker-test.js @@ -1,6 +1,6 @@ const assert = require('assert') -const NonceTracker = require('../../app/scripts/controllers/transactions/nonce-tracker') -const MockTxGen = require('../lib/mock-tx-gen') +const NonceTracker = require('../../../../../app/scripts/controllers/transactions/nonce-tracker') +const MockTxGen = require('../../../../lib/mock-tx-gen') let providerResultStub = {} describe('Nonce Tracker', function () { diff --git a/test/unit/pending-tx-test.js b/test/unit/app/controllers/transactions/pending-tx-test.js similarity index 98% rename from test/unit/pending-tx-test.js rename to test/unit/app/controllers/transactions/pending-tx-test.js index 97ac8524b..e7705c594 100644 --- a/test/unit/pending-tx-test.js +++ b/test/unit/app/controllers/transactions/pending-tx-test.js @@ -3,9 +3,9 @@ const ethUtil = require('ethereumjs-util') const EthTx = require('ethereumjs-tx') const ObservableStore = require('obs-store') const clone = require('clone') -const { createTestProviderTools } = require('../stub/provider') -const PendingTransactionTracker = require('../../app/scripts/controllers/transactions/pending-tx-tracker') -const MockTxGen = require('../lib/mock-tx-gen') +const { createTestProviderTools } = require('../../../../stub/provider') +const PendingTransactionTracker = require('../../../../../app/scripts/controllers/transactions/pending-tx-tracker') +const MockTxGen = require('../../../../lib/mock-tx-gen') const sinon = require('sinon') const noop = () => true const currentNetworkId = 42 diff --git a/test/unit/tx-controller-test.js b/test/unit/app/controllers/transactions/tx-controller-test.js similarity index 98% rename from test/unit/tx-controller-test.js rename to test/unit/app/controllers/transactions/tx-controller-test.js index ddd921652..f1d67f64e 100644 --- a/test/unit/tx-controller-test.js +++ b/test/unit/app/controllers/transactions/tx-controller-test.js @@ -4,9 +4,9 @@ const EthTx = require('ethereumjs-tx') const EthjsQuery = require('ethjs-query') const ObservableStore = require('obs-store') const sinon = require('sinon') -const TransactionController = require('../../app/scripts/controllers/transactions') -const TxGasUtils = require('../../app/scripts/controllers/transactions/tx-gas-utils') -const { createTestProviderTools, getTestAccounts } = require('../stub/provider') +const TransactionController = require('../../../../../app/scripts/controllers/transactions') +const TxGasUtils = require('../../../../../app/scripts/controllers/transactions/tx-gas-utils') +const { createTestProviderTools, getTestAccounts } = require('../../../../stub/provider') const noop = () => true const currentNetworkId = 42 diff --git a/test/unit/tx-gas-util-test.js b/test/unit/app/controllers/transactions/tx-gas-util-test.js similarity index 93% rename from test/unit/tx-gas-util-test.js rename to test/unit/app/controllers/transactions/tx-gas-util-test.js index c1d5966da..d1ee86033 100644 --- a/test/unit/tx-gas-util-test.js +++ b/test/unit/app/controllers/transactions/tx-gas-util-test.js @@ -3,8 +3,8 @@ const Transaction = require('ethereumjs-tx') const BN = require('bn.js') -const { hexToBn, bnToHex } = require('../../app/scripts/lib/util') -const TxUtils = require('../../app/scripts/controllers/transactions/tx-gas-utils') +const { hexToBn, bnToHex } = require('../../../../../app/scripts/lib/util') +const TxUtils = require('../../../../../app/scripts/controllers/transactions/tx-gas-utils') describe('txUtils', function () { diff --git a/test/unit/tx-helper-test.js b/test/unit/app/controllers/transactions/tx-helper-test.js similarity index 88% rename from test/unit/tx-helper-test.js rename to test/unit/app/controllers/transactions/tx-helper-test.js index cc6543c30..ce54ef483 100644 --- a/test/unit/tx-helper-test.js +++ b/test/unit/app/controllers/transactions/tx-helper-test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const txHelper = require('../../ui/lib/tx-helper') +const txHelper = require('../../../../../ui/lib/tx-helper') describe('txHelper', function () { it('always shows the oldest tx first', function () { diff --git a/test/unit/tx-state-history-helper-test.js b/test/unit/app/controllers/transactions/tx-state-history-helper-test.js similarity index 95% rename from test/unit/tx-state-history-helper-test.js rename to test/unit/app/controllers/transactions/tx-state-history-helper-test.js index 5ad014dbb..f4c3a6be1 100644 --- a/test/unit/tx-state-history-helper-test.js +++ b/test/unit/app/controllers/transactions/tx-state-history-helper-test.js @@ -1,6 +1,6 @@ const assert = require('assert') -const txStateHistoryHelper = require('../../app/scripts/controllers/transactions/lib/tx-state-history-helper') -const testVault = require('../data/v17-long-history.json') +const txStateHistoryHelper = require('../../../../../app/scripts/controllers/transactions/lib/tx-state-history-helper') +const testVault = require('../../../../data/v17-long-history.json') describe ('Transaction state history helper', function () { diff --git a/test/unit/tx-state-manager-test.js b/test/unit/app/controllers/transactions/tx-state-manager-test.js similarity index 98% rename from test/unit/tx-state-manager-test.js rename to test/unit/app/controllers/transactions/tx-state-manager-test.js index 179542f90..20bc08b94 100644 --- a/test/unit/tx-state-manager-test.js +++ b/test/unit/app/controllers/transactions/tx-state-manager-test.js @@ -1,8 +1,8 @@ const assert = require('assert') const clone = require('clone') const ObservableStore = require('obs-store') -const TxStateManager = require('../../app/scripts/controllers/transactions/tx-state-manager') -const txStateHistoryHelper = require('../../app/scripts/controllers/transactions/lib/tx-state-history-helper') +const TxStateManager = require('../../../../../app/scripts/controllers/transactions/tx-state-manager') +const txStateHistoryHelper = require('../../../../../app/scripts/controllers/transactions/lib/tx-state-history-helper') const noop = () => true describe('TransactionStateManager', function () { diff --git a/test/unit/tx-utils-test.js b/test/unit/app/controllers/transactions/tx-utils-test.js similarity index 97% rename from test/unit/tx-utils-test.js rename to test/unit/app/controllers/transactions/tx-utils-test.js index be16225ba..115127f85 100644 --- a/test/unit/tx-utils-test.js +++ b/test/unit/app/controllers/transactions/tx-utils-test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const txUtils = require('../../app/scripts/controllers/transactions/lib/util') +const txUtils = require('../../../../../app/scripts/controllers/transactions/lib/util') describe('txUtils', function () { diff --git a/test/unit/edge-encryptor-test.js b/test/unit/app/edge-encryptor-test.js similarity index 97% rename from test/unit/edge-encryptor-test.js rename to test/unit/app/edge-encryptor-test.js index d3f014d74..cc9777389 100644 --- a/test/unit/edge-encryptor-test.js +++ b/test/unit/app/edge-encryptor-test.js @@ -1,6 +1,6 @@ const assert = require('assert') -const EdgeEncryptor = require('../../app/scripts/edge-encryptor') +const EdgeEncryptor = require('../../../app/scripts/edge-encryptor') var password = 'passw0rd1' var data = 'some random data' diff --git a/test/unit/message-manager-test.js b/test/unit/app/message-manager-test.js similarity index 97% rename from test/unit/message-manager-test.js rename to test/unit/app/message-manager-test.js index 5e7039841..36ef6c29f 100644 --- a/test/unit/message-manager-test.js +++ b/test/unit/app/message-manager-test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const MessageManager = require('../../app/scripts/lib/message-manager') +const MessageManager = require('../../../app/scripts/lib/message-manager') describe('Message Manager', function () { let messageManager diff --git a/test/unit/nodeify-test.js b/test/unit/app/nodeify-test.js similarity index 92% rename from test/unit/nodeify-test.js rename to test/unit/app/nodeify-test.js index c7b127889..901603c8b 100644 --- a/test/unit/nodeify-test.js +++ b/test/unit/app/nodeify-test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const nodeify = require('../../app/scripts/lib/nodeify') +const nodeify = require('../../../app/scripts/lib/nodeify') describe('nodeify', function () { var obj = { diff --git a/test/unit/pending-balance-test.js b/test/unit/app/pending-balance-test.js similarity index 94% rename from test/unit/pending-balance-test.js rename to test/unit/app/pending-balance-test.js index dc4c1c3e4..1418e4a4e 100644 --- a/test/unit/pending-balance-test.js +++ b/test/unit/app/pending-balance-test.js @@ -1,6 +1,6 @@ const assert = require('assert') -const PendingBalanceCalculator = require('../../app/scripts/lib/pending-balance-calculator') -const MockTxGen = require('../lib/mock-tx-gen') +const PendingBalanceCalculator = require('../../../app/scripts/lib/pending-balance-calculator') +const MockTxGen = require('../../lib/mock-tx-gen') const BN = require('ethereumjs-util').BN let providerResultStub = {} diff --git a/test/unit/personal-message-manager-test.js b/test/unit/app/personal-message-manager-test.js similarity index 97% rename from test/unit/personal-message-manager-test.js rename to test/unit/app/personal-message-manager-test.js index ec2f9a4d1..b07167bff 100644 --- a/test/unit/personal-message-manager-test.js +++ b/test/unit/app/personal-message-manager-test.js @@ -1,6 +1,6 @@ const assert = require('assert') -const PersonalMessageManager = require('../../app/scripts/lib/personal-message-manager') +const PersonalMessageManager = require('../../../app/scripts/lib/personal-message-manager') describe('Personal Message Manager', function () { let messageManager diff --git a/test/unit/seed-phrase-verifier-test.js b/test/unit/app/seed-phrase-verifier-test.js similarity index 95% rename from test/unit/seed-phrase-verifier-test.js rename to test/unit/app/seed-phrase-verifier-test.js index 4e314806b..b0da534da 100644 --- a/test/unit/seed-phrase-verifier-test.js +++ b/test/unit/app/seed-phrase-verifier-test.js @@ -1,9 +1,9 @@ const assert = require('assert') const clone = require('clone') const KeyringController = require('eth-keyring-controller') -const firstTimeState = require('../../app/scripts/first-time-state') -const seedPhraseVerifier = require('../../app/scripts/lib/seed-phrase-verifier') -const mockEncryptor = require('../lib/mock-encryptor') +const firstTimeState = require('../../../app/scripts/first-time-state') +const seedPhraseVerifier = require('../../../app/scripts/lib/seed-phrase-verifier') +const mockEncryptor = require('../../lib/mock-encryptor') describe('SeedPhraseVerifier', function () { diff --git a/test/unit/util-test.js b/test/unit/app/util-test.js similarity index 93% rename from test/unit/util-test.js rename to test/unit/app/util-test.js index 6da185b2c..670bc4d22 100644 --- a/test/unit/util-test.js +++ b/test/unit/app/util-test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const { sufficientBalance } = require('../../app/scripts/lib/util') +const { sufficientBalance } = require('../../../app/scripts/lib/util') describe('SufficientBalance', function () { diff --git a/test/unit/migrations-test.js b/test/unit/migrations/migrations-test.js similarity index 81% rename from test/unit/migrations-test.js rename to test/unit/migrations/migrations-test.js index 5bad25a45..50afd9c2e 100644 --- a/test/unit/migrations-test.js +++ b/test/unit/migrations/migrations-test.js @@ -1,22 +1,22 @@ const assert = require('assert') const path = require('path') -const wallet1 = require(path.join('..', 'lib', 'migrations', '001.json')) -const vault4 = require(path.join('..', 'lib', 'migrations', '004.json')) +const wallet1 = require(path.join('..', '..', 'lib', 'migrations', '001.json')) +const vault4 = require(path.join('..', '..', 'lib', 'migrations', '004.json')) let vault5, vault6, vault7, vault8, vault9 // vault10, vault11 -const migration2 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '002')) -const migration3 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '003')) -const migration4 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '004')) -const migration5 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '005')) -const migration6 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '006')) -const migration7 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '007')) -const migration8 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '008')) -const migration9 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '009')) -const migration10 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '010')) -const migration11 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '011')) -const migration12 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '012')) -const migration13 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '013')) +const migration2 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '002')) +const migration3 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '003')) +const migration4 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '004')) +const migration5 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '005')) +const migration6 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '006')) +const migration7 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '007')) +const migration8 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '008')) +const migration9 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '009')) +const migration10 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '010')) +const migration11 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '011')) +const migration12 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '012')) +const migration13 = require(path.join('..', '..', '..', 'app', 'scripts', 'migrations', '013')) const oldTestRpc = 'https://rawtestrpc.metamask.io/' diff --git a/test/unit/migrator-test.js b/test/unit/migrations/migrator-test.js similarity index 90% rename from test/unit/migrator-test.js rename to test/unit/migrations/migrator-test.js index 4404e1dc4..a9374dff1 100644 --- a/test/unit/migrator-test.js +++ b/test/unit/migrations/migrator-test.js @@ -1,7 +1,7 @@ const assert = require('assert') const clone = require('clone') -const Migrator = require('../../app/scripts/lib/migrator/') -const liveMigrations = require('../../app/scripts/migrations/') +const Migrator = require('../../../app/scripts/lib/migrator/') +const liveMigrations = require('../../../app/scripts/migrations/') const stubMigrations = [ { version: 1, @@ -33,7 +33,7 @@ const versionedData = {meta: {version: 0}, data: {hello: 'world'}} const firstTimeState = { meta: { version: 0 }, - data: require('../../app/scripts/first-time-state'), + data: require('../../../app/scripts/first-time-state'), } describe('Migrator', () => {