diff options
author | kumavis <kumavis@users.noreply.github.com> | 2018-03-07 09:21:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-07 09:21:36 +0800 |
commit | 8a444ec96f3127bd606b8d1fcf2b53e9c693cb03 (patch) | |
tree | 7ddc788dac09793e93945c02add63c821954111f /test | |
parent | 8e0131cbb52eae9d0fd07ac20d1e39bae99446e1 (diff) | |
parent | f9de87af51ccb1190ca93e524de24f8a32ea3d9e (diff) | |
download | tangerine-wallet-browser-8a444ec96f3127bd606b8d1fcf2b53e9c693cb03.tar tangerine-wallet-browser-8a444ec96f3127bd606b8d1fcf2b53e9c693cb03.tar.gz tangerine-wallet-browser-8a444ec96f3127bd606b8d1fcf2b53e9c693cb03.tar.bz2 tangerine-wallet-browser-8a444ec96f3127bd606b8d1fcf2b53e9c693cb03.tar.lz tangerine-wallet-browser-8a444ec96f3127bd606b8d1fcf2b53e9c693cb03.tar.xz tangerine-wallet-browser-8a444ec96f3127bd606b8d1fcf2b53e9c693cb03.tar.zst tangerine-wallet-browser-8a444ec96f3127bd606b8d1fcf2b53e9c693cb03.zip |
Merge pull request #3259 from MetaMask/controllerStubs
Offline testing
Diffstat (limited to 'test')
-rw-r--r-- | test/stub/blacklist.json | 1374 | ||||
-rw-r--r-- | test/unit/blacklist-controller-test.js | 2 | ||||
-rw-r--r-- | test/unit/metamask-controller-test.js | 176 | ||||
-rw-r--r-- | test/unit/network-contoller-test.js | 44 |
4 files changed, 1470 insertions, 126 deletions
diff --git a/test/stub/blacklist.json b/test/stub/blacklist.json new file mode 100644 index 000000000..6a3230b2f --- /dev/null +++ b/test/stub/blacklist.json @@ -0,0 +1,1374 @@ +{ + "version": 2, + "tolerance": 2, + "fuzzylist": [ + "metamask.io", + "myetherwallet.com", + "cryptokitties.co", + "mycrypto.com" + ], + "whitelist": [ + "crypto.pro", + "ocrypto.org", + "wecrypto.net", + "iccrypto.io", + "crypto.kred", + "ohmycrypto.io", + "spcrypto.net", + "melcrypto.com", + "zzcrypto.org", + "zzcrypto.net", + "crypto.bg", + "mycrypto24.online", + "acrypto.io", + "mycrypto.ca", + "scrypto.io", + "mycrypto.dk", + "mvzcrypto.com", + "ambcrypto.com", + "crypto.bi", + "crypto.jobs", + "crypto.help", + "my.crypt.observer", + "crypt.observer", + "ucrypto.com", + "cryptojobslist.com", + "crypto.review", + "crypto.me", + "b3crypto.com", + "mycrypto.ninja", + "jkcrypto.com", + "crypto.cr", + "mycrypto.live", + "yocrypto.io", + "crypto.ba", + "zacrypto.info", + "mycrypto.com", + "remix.ethereum.org", + "metahash.io", + "metahash.net", + "metahash.org", + "cryptotitties.com", + "cryptocities.net", + "cryptoshitties.co", + "cryptotitties.fun", + "cryptokitties.forsale", + "cryptokitties.care", + "metamate.cc", + "metamesh.tech", + "ico.nexus.social", + "metamesh.org", + "metatask.io", + "metmask.com", + "metarasa.com", + "metapack.com", + "metacase.com", + "metafas.nl", + "metamako.com", + "metamast.com", + "metamax.ru", + "metadesk.io", + "metadisk.com", + "metallsk.ru", + "metamag.fr", + "metamaks.ru", + "metamap.ru", + "metamaps.cc", + "metamats.com", + "metamax.by", + "metamax.com", + "metamax.io", + "metamuse.net", + "metarank.com", + "metaxas.com", + "megamas2.ru", + "metamask.io", + "myetherwallet.com", + "myethlerwallet.com", + "ethereum.org", + "myetheroll.com", + "myetherapi.com", + "ledgerwallet.com", + "databrokerdao.com", + "etherscan.io", + "etherid.org", + "ether.cards", + "etheroll.com", + "ethnews.com", + "ethex.market", + "ethereumdev.io", + "ethereumdev.kr", + "dether.io", + "ethermine.org", + "slaask.com", + "etherbtc.io", + "ethereal.capital", + "etherisc.com", + "m.famalk.net", + "etherecho.com", + "ethereum.os.tc", + "theethereum.wiki", + "metajack.im", + "etherhub.io", + "ethereum.network", + "ethereum.link", + "ethereum.com", + "prethereum.org", + "ethereumj.io", + "etheraus.com", + "ethereum.dev", + "1ethereum.ru", + "ethereum.nz", + "nethereum.com", + "metabank.com", + "metamas.com", + "aventus.io", + "metabase.com", + "etherdelta.com", + "metabase.one", + "cryptokitties.co", + "remme.io", + "jibrel.network" + ], + "blacklist": [ + "xn--myethrwalle-jb9e19a.com", + "xn--myetheralle-7b9ezl.com", + "iconfoundation.co", + "fundrequest.info", + "xn--myetherwale-os8e7x.com", + "remme-ico.eu", + "gonetwork.live", + "token.gonetwork.pro", + "gonetwork.pro", + "gonetwork.eu", + "nucleus-vision.cc", + "jibreltoken.in", + "dock.so", + "dock.promo", + "xn--mycrypt-r0a.com", + "xn--mycrypt-g1a.com", + "xn--mycrpto-y2a.com", + "ethexploit.org", + "remme.in", + "remme.ws", + "remme.com.ng", + "nyeitthervvallet.com", + "xn--myeerhwailet-ooc.com", + "myeterhwaliot.com", + "remme.live", + "xn--yethewalle-to2exkhi.com", + "myetherwallet.custom-token.com", + "custom-token.com", + "sale-earn.com", + "bankera.live", + "originprotocol.io", + "trx.foundation", + "tokensale.adhive.net", + "adhive.net", + "decentral.market", + "cryptoexploite.com", + "blockclain.net", + "xn--blckchin-5za9o.info", + "xn--blkhain-m0a4pb.info", + "xn--blocchal-gmb8m.info", + "xn--blocchaln-orb.info", + "xn--blocchan-gmb7c.info", + "xn--blockaden-lsen-5pb.com", + "xn--blockchai-3vb.info", + "xn--blockchai-jvb.info", + "xn--blockchal-3vb.info", + "xn--blockcham-ipb.info", + "xn--blockchan-2pb.com", + "xn--blockchan-75a.com", + "xn--blockchan-7sb.info", + "xn--blockchan-d5a.net", + "xn--blockchan-dob.info", + "xn--blockchan-ipb.com", + "xn--blockchan-ipb.info", + "xn--blockchan-nk7d.com", + "xn--blockchan-xub.info", + "xn--blockchann-4ub.com", + "xn--blockchi-n7a50e.info", + "xn--blockchi-o8a54d.info", + "xn--blockchi-p99co8a.com", + "xn--blockchim-hdb.info", + "xn--blockchin-1xb.info", + "xn--blockchin-61a.info", + "xn--blockchin-61a.net", + "xn--blockchin-6ib.info", + "xn--blockchin-ccb.info", + "xn--blockchin-h4a.com", + "xn--blockchin-h4a.info", + "xn--blockchin-hdb.info", + "xn--blockchin-hhb.info", + "xn--blockchin-mib.net", + "xn--blockchin-wcb.com", + "xn--blockchn-fza4j.com", + "xn--blockchn-fza4j.info", + "xn--blockchn-n7a43b.info", + "xn--blockchn-p0a.info", + "xn--blockchn-tx0d4p.com", + "xn--blockclai-3vb.info", + "xn--blockclin-hdb.com", + "xn--blockclin-hdb.info", + "xn--blockclin-hdb.org", + "xn--blockflte-kirchrode-w6b.de", + "xn--blockfltenquartett-windspiel-81c.de", + "xn--blockhai-obb78c.info", + "xn--blockhain-4eb.com", + "xn--blockhain-pfb.com", + "xn--blockhain-pfb.info", + "xn--blockhain-zdb.info", + "xn--blockhan-obb65a.info", + "xn--blockhas-d6a.com", + "xn--blockwallt-j7a.com", + "xn--blokchai-fqb.info", + "xn--blokchain-nfb.info", + "xn--blokhain-28ab.info", + "xn--bockclnain-eyb.info", + "xn--mymoeo-zt7bzf.com", + "xn--mymoer-nqc1368c.com", + "xn--mymoero-c13c.com", + "xn--mymoero-s13c.com", + "xn--mymoneo-f63c.com", + "xn--mymoneo-v63c.com", + "xn--mymoneo-y53c.com", + "xn--mymoner-j0a.com", + "xn--mymoner-j5b.com", + "xn--mymoner-r0a.com", + "xn--mymoner-z0a.com", + "xn--mymoner-z2c.com", + "xn--mymonro-fya.com", + "xn--mymonro-x8a.com", + "xn--myetheallet-l58emu.com", + "xn--myetheraet-9k2ea77h.com", + "xn--myetheralet-ms8e21b.com", + "xn--myetheralle-7b9exm.com", + "xn--myetherallet-5s5f.com", + "xn--myetherallet-fs5f.com", + "xn--myetherewalle-1t1g.com", + "xn--myetherllet-pl9e6k.com", + "xn--myethervvalle-8vc.com", + "xn--myetherwaet-61ea.com", + "xn--myetherwaet-8eda.com", + "xn--myetherwaet-ns8ea.com", + "xn--myetherwale-ns8e8x.com", + "xn--myetherwalet-0fb.com", + "xn--myetherwalet-0z4f.com", + "xn--myetherwalet-814f.com", + "xn--myetherwalet-d9b.com", + "xn--myetherwalet-h14f.com", + "xn--myetherwalle-9me.com", + "xn--myetherwalle-ek5f.com", + "xn--myetherwalle-fqc.com", + "xn--myetherwalle-opc.com", + "xn--myetherwalle-q05f.com", + "xn--myetherwllet-wob.com", + "xn--myetherwllt-r7a0i.com", + "xn--myethewaliet-9d5f.com", + "xn--myethewalle-3ic0947g.com", + "xn--myethewallet-0e5f.com", + "xn--myethewallet-1kc.com", + "xn--myethewallet-bkc.com", + "xn--myethewallet-vof.com", + "xn--myethewalliet-nm1g.com", + "xn--myethewallt-kbb3019g.com", + "xn--myethewallt-w48ew7b.com", + "xn--myethrwalet-6qb6408g.com", + "xn--myethrwalet-ms8e83d.com", + "xn--myethrwallet-1db.com", + "xn--myethrwallt-29af.com", + "xn--myethrwallt-29as.com", + "xn--myethrwllet-q7a31e.com", + "xn--myethrwllet-r8a3c.com", + "fintrux.eu", + "refereum-ico.eu", + "arcblock-ico.org", + "xn--fuson-1sa.org", + "refereum-token.com", + "fintrux.co", + "ico-ton.org", + "xn--mytherwallt-cbbv.com", + "xmoneta.co", + "data-wallet.co", + "tokensale.data-wallet.co", + "xn--myeerhwallot-ooc.com", + "xn--myeterwalet-cm8epi.com", + "xn--myeterwalle-cm8ev6a.com", + "rnyetherumwallet.com", + "republic-protocol.net", + "nyeihitervvallatt.com", + "arcblock.eu", + "republicprotocol.eu", + "tokensale-fusion.com", + "myetherwalletjoin.com", + "medicalchian.com", + "myeahteirwaliet.com", + "myenhtersvvailct.com", + "trinity-token.com", + "xn--eo-yzs.com", + "zilliqa.in", + "sparc.pro", + "myetherwallet.import-tokens.com", + "token-gram.org", + "xn--shapshift-e4a.com", + "xn--shapshift-y4a.com", + "xn--shpeshift-c2a.com", + "xn--shpeshift-r1a.com", + "xn--shapshift-o4a.com", + "xn--shpeshift-w2a.com", + "xn--shapeshft-w5a.com", + "tokensale-fusion.org", + "fusion-ico.com", + "beetolen.com", + "tokencrowdsale.online", + "fusion.tokencrowdsale.online", + "beetokem.com", + "block.chaiins.in", + "origintrail.in", + "bit-z.ru", + "xn--myetherallet-nu5f.com", + "xn--mytherwalet-3qb08c.com", + "xn--myeterwllet-cm8et1d.com", + "xn--mytherwllet-q7a01e.com", + "xn--biance-xt7b.com", + "xn--bnance-wic.com", + "xn--biance-jeb.com", + "xn--bttrx-9za8334c.com", + "wwwkodakcoin.com", + "myetherwallet.uk.com", + "kodakone.cc", + "nyeihitervvallet.com", + "xn--myeterwalet-cm8eoi.com", + "nucleus.foundation", + "beetoken-ico.com", + "data-token.com", + "tron-labs.com", + "ocoin.tech", + "aionfoundation.com", + "ico-telegram.org", + "nyeihitervvallat.com", + "telegramcoin.us", + "daddi.cloud", + "daditoken.com", + "blockarray.org", + "dadi-cloud.net", + "wanchainfunding.org", + "ico-telegram.io", + "iconfoundation.site", + "iost.co", + "beetoken-ico.eu", + "cindicator.network", + "wanchainetwork.org", + "wamchain.org", + "wanchainltd.org", + "wanchainalliance.org", + "nucleus-vision.net", + "ledgerwallet.by", + "nucleuss.vision", + "myenhterswailct.com", + "cobin-hood.com", + "wanchainfoundation.org", + "xn--polniex-ex4c.com", + "xn--polniex-s1a.com", + "xn--polonex-ieb.com", + "xn--polonex-sza.com", + "xn--polonex-zw4c.com", + "xn--polonix-ws4c.com", + "xn--polonix-y8a.com", + "xn--pooniex-ojb.com", + "gramico.info", + "dimnsions.network", + "www-gemini.com", + "login-kucoin.net", + "venchain.foundation", + "grampreico.com", + "tgram.cc", + "ton-gramico.com", + "wwwpaywithink.com", + "coniomi.com", + "paywithnk.com", + "paywithlnk.com", + "iluminatto.com.br", + "pundix.eu", + "xn--bttrx-esay.com", + "xn--bttrex-w8a.com", + "xn--bnance-bwa.com", + "xn--shpeshift-11a.com", + "xn--shapeshif-ts6d.com", + "xn--shapshift-yf7d.com", + "wwwbluzelle.com", + "bluzelie.com", + "nucleus-vision.org", + "omisegonetwork.site", + "etlherzero.com", + "etlherdelta.com", + "xn--condesk-0ya.com", + "xn--condesk-sfb.com", + "xn--coindsk-vs4c.com", + "iexecplatform.com", + "tongramico.com", + "nucleus-vision.eu", + "intchain.network", + "wanchain.cloud", + "bluzelle-ico.com", + "ethzero-wallet.com", + "xn--metherwalle-jb9et7d.com", + "xn--coinesk-jo3c.com", + "venchainfoundation.com", + "myenhtersvvailot.com", + "ether-zero.net", + "ins.foundation", + "nastoken.org", + "telcointoken.com", + "ether0.org", + "eterzero.org", + "bluzelle-ico.eu", + "bleuzelle.com", + "appcoinstoken.org", + "xn--quanstamp-8s6d.com", + "myehntersvvailct.com", + "myeherwalllet.com", + "ico-bluzelle.com", + "bluzelle.im", + "bluzelle.one", + "bluzele.sale", + "bluzele.co", + "sether.ws", + "xn--myetherwalet-6gf.com", + "xn--rnyethewaliet-om1g.com", + "rnyethervailet.com", + "mvetherwaliet.com", + "rnyetherwailet.com", + "myethervaliet.com", + "rnyethervaliet.com", + "mvetherwalilet.com", + "xn--myethewalie-3ic0947g.com", + "xn--mthrwallet-z6ac3y.com", + "xn--myeherwalie-vici.com", + "xn--myethervvalie-8vc.com", + "xn--mythrwallt-06acf.com", + "xn--mtherwallet-y9a6y.com", + "myetherwallet.applytoken.tk", + "ethereum-zero.com", + "quanstamptoken.tk", + "bluzelle.network", + "ether-wallet.org", + "tron-wallet.info", + "appcoinsproject.com", + "vechain.foundation", + "tronlab.site", + "tronlabs.network", + "bluzelle.cc", + "ethblender.com", + "ethpaperwallet.net", + "waltontoken.org", + "icoselfkey.org", + "etherzeroclaim.com", + "etherzero.promo", + "bluzelle.pro", + "token-selfkey.org", + "xn--etherdlta-0f7d.com", + "sether.in", + "xn--ttrex-ysa9423c.com", + "bluzelle.eu", + "bluzelle.site", + "gifto.tech", + "xn--os-g7s.com", + "selfkey.co", + "xn--myeherwalet-ns8exy.com", + "xn--coinelegraph-wk5f.com", + "dai-stablecoin.com", + "eos-token.org", + "venchain.org", + "gatcoins.io", + "deepbrainchain.co", + "myetherwalililet.info", + "myehvterwallet.com", + "myehterumswallet.com", + "nucleusico.com", + "tronlab.tech", + "0x-project.com", + "gift-token-events.mywebcommunity.org", + "funfairtoken.org", + "breadtokenapp.com", + "cloudpetstore.com", + "myethwalilet.com", + "selfkeys.org", + "wallet-ethereum.com", + "xn--methrwallt-26ar0z.com", + "xn--mytherwllet-r8a0c.com", + "bluzelle.promo", + "tokensale.bluzelle.promo", + "cedarlake.org", + "marketingleads4u.com", + "cashaa.co", + "xn--inance-hrb.com", + "wanchain.tech", + "zenprolocol.com", + "ethscan.io", + "etherscan.in", + "props-project.com", + "zilliaq.com", + "reqestnetwork.com", + "etherdelta.pw", + "ethereum-giveaway.org", + "mysimpletoken.org", + "binancc.com", + "blnance.org", + "elherdelta.io", + "xn--hapeshit-ez9c2y.com", + "tenxwallet.co", + "singularitynet.info", + "mytlherwaliet.info", + "iconmainnet.ml", + "tokenselfkey.org", + "xn--myetewallet-cm8e5y.com", + "envione.org", + "myetherwalletet.com", + "claimbcd.com", + "ripiocreditnetwork.in", + "xn--yeterwallet-ml8euo.com", + "ethclassicwallet.info", + "myltherwallet.ru.com", + "etherdella.com", + "xn--yeterwallet-bm8ewn.com", + "singularty.net", + "cloudkitties.co", + "iconfoundation.io", + "kittystat.com", + "gatscoin.io", + "singularitynet.in", + "sale.canay.io", + "canay.io", + "wabicoin.co", + "envion.top", + "sirinslabs.com", + "tronlab.co", + "paxful.com.ng", + "changellyli.com", + "ethereum-code.com", + "xn--plonex-6va6c.com", + "envion.co", + "envion.cc", + "envion.site", + "ethereumchain.info", + "xn--envon-1sa.org", + "xn--btstamp-rfb.net", + "envlon.org", + "envion-ico.org", + "spectivvr.org", + "sirinlbs.com", + "ethereumdoubler.life", + "xn--myetherwllet-fnb.com", + "sirin-labs.com", + "sirin-labs.org", + "envion.one", + "envion.live", + "propsproject.org", + "propsprojects.com", + "decentralland.org", + "xn--metherwalet-ns8ep4b.com", + "redpulsetoken.co", + "propsproject.tech", + "xn--myeterwalet-nl8emj.com", + "powrerledger.com", + "cryptokitties.com", + "sirinlabs.pro", + "sirinlabs.co", + "sirnlabs.com", + "superbitcoin-blockchain.info", + "hellobloom.me", + "mobus.network", + "powrrledger.com", + "xn--myeherwalet-ms8eyy.com", + "qlink-ico.com", + "gatcoin.in", + "tokensale.gamefllp.com", + "gamefllp.com", + "xn--myeherwalle-vici.com", + "xn--myetherwalet-39b.com", + "xn--polonex-ffb.com", + "xn--birex-leba.com", + "raiden-network.org", + "sirintabs.com", + "xn--metherwallt-79a30a.com", + "xn--myethrwllet-2kb3p.com", + "myethlerwallet.eu", + "xn--btrex-b4a.com", + "powerrledger.com", + "xn--cointeegraph-wz4f.com", + "myerherwalet.com", + "qauntstanp.com", + "myetherermwallet.com", + "xn--myethewalet-ns8eqq.com", + "xn--nvion-hza.org", + "nnyetherwallelt.ru.com", + "ico-wacoin.com", + "xn--myeterwalet-nl8enj.com", + "bitcoinsilver.io", + "t0zero.com", + "tokensale.gizer.in", + "gizer.in", + "wabitoken.com", + "gladius.ws", + "xn--metherwallt-8bb4w.com", + "quanttstamp.com", + "gladius.im", + "ethereumstorage.net", + "powerledgerr.com", + "xn--myeherwallet-4j5f.com", + "quamtstamp.com", + "quntstamp.com", + "xn--changely-j59c.com", + "shapeshlft.com", + "coinbasenews.co.uk", + "xn--metherwallet-hmb.com", + "envoin.org", + "powerledger.com", + "bitstannp.net", + "xn--myetherallet-4k5fwn.com", + "xn--coinbas-pya.com", + "requestt.network", + "oracls.network", + "sirinlabs.website", + "powrledger.io", + "slackconfirm.com", + "shape-shift.io", + "oracles-network.org", + "xn--myeherwalle-zb9eia.com", + "blockstack.one", + "urtust.io", + "bittrex.one", + "t0-ico.com", + "xn--cinbase-90a.com", + "xn--metherwalet-ns8ez1g.com", + "tzero-ico.com", + "tzero.su", + "tzero.website", + "blockstack.network", + "ico-tzero.com", + "spectre.site", + "tzero.pw", + "spectre-ai.net", + "xn--waxtokn-y8a.com", + "dmarket.pro", + "bittrex.com11648724328774.cf", + "bittrex.com1987465798.ga", + "autcus.org", + "t-zero.org", + "xn--zero-zxb.com", + "myetherwalletfork.com", + "blokclbain.info", + "datum.sale", + "spectre-ai.org", + "powerledgr.com", + "simpletoken.live", + "sale.simpletoken.live", + "qauntstamp.com", + "raiden-network.com", + "metalpayme.com", + "quantstamp-ico.com", + "myetherwailetclient.com", + "biockchain.biz", + "wallets-blockchain.com", + "golemairdrop.com", + "omisegoairdrop.net", + "blodkchainwallet.info", + "walton-chain.org", + "elite888-ico.com", + "bitflyerjp.com", + "chainlinksmartcontract.com", + "stormtoken.eu", + "omise-go.tech", + "saltending.com", + "stormltoken.com", + "xn--quanttamp-42b.com", + "stormtoken.co", + "storntoken.com", + "stromtoken.com", + "storm-token.com", + "stormtokens.io", + "ether-delta.com", + "ethconnect.live", + "ethconnect.trade", + "xn--bttrex-3va.net", + "quantstamp.com.co", + "wancha.in", + "augur-network.com", + "quantstamp.com.ua", + "myetherwalletmew.com", + "myetherumwalletts.com", + "xn--quanstamp-tmd.com", + "quantsstamps.com", + "changellyl.net", + "xn--myetherwalet-1fb.com", + "myethereumwallets.com", + "xn--myetherwalet-e9b.com", + "quantslamp.com", + "metelpay.com", + "xn--eterdelta-m75d.com", + "linksmartcontract.com", + "myetherwalletaccess.com", + "myetherwalletcheck.com", + "myetherwalletcheck.info", + "myetherwalletconf.com", + "myetherwalleteal.com", + "myetherwalletec.com", + "myetherwalletgeth.com", + "myetherwalletmetamask.com", + "myetherwalletmm.com", + "myetherwalletmy.com", + "myetherwalletnh.com", + "myetherwalletnod.com", + "myetherwalletrr.com", + "myetherwalletrty.com", + "myetherwalletsec.com", + "myetherwalletsecure.com", + "myetherwalletutc.com", + "myetherwalletver.info", + "myetherwalletview.com", + "myetherwalletview.info", + "myetherwalletvrf.com", + "myetherwalletmist.com", + "myetherwalletext.com", + "myetherwalletjson.com", + "mettalpay.com", + "bricklblock.io", + "bittrexy.com", + "utrust.so", + "myethierwallet.org", + "metallpay.com", + "kraken-wallet.com", + "dmarkt.io", + "etherdeltla.com", + "unlversa.io", + "universa.sale", + "mercuryprotocol.live", + "ripiocredlt.network", + "myetlherwa11et.com", + "dentacoin.in", + "rdrtg.com", + "myetherwallet.com.rdrgh.com", + "rdrgh.com", + "ripiocreditnetwork.co", + "riaden.network", + "hydrominer.biz", + "rdrblock.com", + "reqest.network", + "senstoken.com", + "myetherwallat.services", + "ripiocredit.net", + "xn--metherwallet-c06f.com", + "ico.ripiocredits.com", + "ripiocredits.com", + "raidens.network", + "artoken.co", + "myetherwalletlgn.com", + "etherblog.click", + "stormtoken.site", + "httpmyetherwallet.com", + "myetherwalletverify.com", + "byzantiumfork.com", + "myetherwallet.com.byzantiumfork.com", + "www-myethervvallet.com", + "ether24.info", + "block-v.io", + "bittrex.cash", + "shapishift.io", + "ripiocerdit.network", + "rnyetherwa11et.com", + "claimether.com", + "enigmatokensale.com", + "ethereum-org.com", + "mvetnerwallet.com", + "myctherwallet.com", + "myetherwaltet.com", + "myetherwatlet.com", + "privatix.me", + "myetherwalletcnf.com", + "myetherwalletver.com", + "privatix.top", + "privatix.pro", + "privatex.io", + "stormtoken.cc", + "raiden.online", + "stormstoken.com", + "myetereumwallet.com", + "stormtokens.net", + "myetherwalletconf.info", + "storrntoken.com", + "worldofbattles.io", + "ico.worldofbattles.io", + "privatix.live", + "riden.network", + "raidan.network", + "ralden.network", + "mymyetherwallet.com", + "myetherwallets.net", + "myetherwalletverify.info", + "stormxtoken.com", + "myethereum-wallet.com", + "myetherwallet-forkprep.pagedemo.co", + "myetnerwailet.com", + "www-mvetherwallet.com", + "etheirdelta.com", + "myetherwalletiu.com", + "myetherwaiiett.com", + "xn--mytherwalet-cbb87i.com", + "xn--myethrwallet-ivb.co", + "xn--myeterwallet-f1b.com", + "myehterwaliet.com", + "omegaone.co", + "myetherwaiietw.com", + "slack.com.ru", + "polkodot.network", + "request-network.net", + "requestnetwork.live", + "binancie.com", + "first-eth.info", + "myewerthwalliet.com", + "enjincoin.pw", + "xn--bitrex-k17b.com", + "alrswap.io", + "www-request.network", + "myetnenwallet.com", + "www-enigma.co", + "cryptoinsidenews.com", + "air-swap.tech", + "launch.airswap.cc", + "airswap.cc", + "airswaptoken.com", + "launch.airswap.in", + "airswap.in", + "security-steemit.com.mx", + "blockchalnwallet.com", + "blodkchainwallet.com", + "blodkchaln.com", + "myethereumwaiiet.com", + "myethereumwaliet.com", + "myethereumwalilet.com", + "myetherswailet.com", + "myetherswaliet.com", + "myetherswalilet.com", + "myetherwalilett.com", + "myetherwalletl.com", + "myetherwalletww.com", + "myethereunwallet.com", + "myethereumwallct.com", + "myetherwaiieti.com", + "myetherwaiiete.com", + "upfirng.com", + "paypie.net", + "paypie.tech", + "soam.co", + "myetherwaiict.com", + "numerai-token.com", + "www-bankera.com", + "vvanchain.org", + "omisegoairdrop.com", + "xn--enjncoin-41a.io", + "suncontract.su", + "myetherwaiietr.com", + "shapeshiff.io", + "warchain.org", + "myethwallett.com", + "myethervvaliet.com", + "wanchains.org", + "etherparty.in", + "enjincoin.me", + "etiam.io", + "invest.smartlands.tech", + "smartlands.tech", + "enijncoin.io", + "wanchain.network", + "nimiq.su", + "enjincoin.sale", + "tenxwallet.io", + "golem-network.net", + "myyethwallet.ml", + "mywetherwailiet.com", + "omg-omise.com", + "district0x.tech", + "centra-token.com", + "etherdetla.com", + "etnerparty.io", + "etherdelta.su", + "myetherwallett.neocities.org", + "myetherwallet-secure.com", + "myethereumwalletntw.info", + "real-markets.io", + "wallet-ethereum.org", + "request-network.com", + "shapeshifth.io", + "shiapeshift.in", + "coin.red-puise.com", + "ibittreix.com", + "coinkbase.com", + "cindicator.pro", + "myetherwallet.com.ailogin.me", + "eventchain.co", + "kinkik.in", + "myetherumwalletview.com", + "protostokenhub.com", + "coinrbase.com", + "myetherwalletlogin.com", + "omisegotoken.com", + "myethereumwalletntw.com", + "reall.markets", + "cobinhood.org", + "cobinhood.io", + "happy-coin.org", + "bitfinex.com.co", + "bitfienex.com", + "iconn.foundation", + "centra.vip", + "smartcontract.live", + "icon.community", + "air-token.com", + "centra.credit", + "myetherwallet-singin.com", + "smartcontractlink.com", + "shapesshift.io", + "0xtoken.io", + "augurproject.co", + "ethereumus.one", + "myetherumwalet.com", + "myetherwalletsignin.com", + "change-bank.org", + "charge-bank.com", + "myetherwalletsingin.com", + "myetherwalletcontract.com", + "change-bank.io", + "chainlink.tech", + "myetherwallet-confirm.com", + "tokensale.kybernet.network", + "kybernet.network", + "kyberr.network", + "kybernetwork.io", + "myetherwalletconfirm.com", + "kvnuke.github.io", + "kin.kikpro.co", + "myethereumwallet.co.uk", + "tokensale-kyber.network", + "kyber-network.co", + "tokensale.kyber-network.co", + "pyro0.github.io", + "tokensale.kyber.digital", + "kyber.digital", + "omise-go.me", + "my.etherwallet.com.de", + "bepartof.change-bank.co", + "change-bank.co", + "enigma-tokens.co", + "coinbase.com.eslogin.co", + "xn--bittrx-mva.com", + "ethrdelta.github.io", + "etherdellta.com", + "ico-nexus.social", + "red-pulse.tech", + "bitj0b.io", + "xn--bttrex-bwa.com", + "kin-klk.com", + "kin-crowdsale.com", + "ethedelta.com", + "coindash.su", + "myethwallet.co.uk", + "swarm.credit", + "myethereumwallet.uk", + "iconexu.social", + "wanchain.co", + "enigrna.co", + "linknetwork.co", + "qtum-token.com", + "omisego.com.co", + "rivetzintl.org", + "etherdelta.one", + "the-ether.pro", + "etherdelta.gitnub.io", + "kirkik.com", + "monetha.ltd", + "vlberate.io", + "ethereumwallet-kr.info", + "omise-go.org", + "iconexus.social", + "bittirrex.com", + "aventus.pro", + "atlant.solutions", + "aventus.group", + "metamak.io", + "omise.com.co", + "herotokens.io", + "starbase.pro", + "etherdelta.githulb.io", + "herotoken.co", + "kinico.net", + "dmarket.ltd", + "etherdelta.gilthub.io", + "golem-network.com", + "etnerscan.io", + "bllttriex.com", + "monetha.me", + "monetha.co", + "monetha-crowdsale.com", + "starbase.tech", + "aventus-crowdsale.com", + "shapeshift.pro", + "bllttrex.com", + "kickico.co", + "statustoken.im", + "bilttrex.com", + "tenxpay.io", + "bittrex.ltd", + "metalpay.im", + "aragon.im", + "coindash.tech", + "decentraland.tech", + "decentraland.pro", + "status-token.com", + "bittrex.cam", + "enigmatoken.com", + "unocoin.company", + "unocoin.fund", + "0xproject.io", + "0xtoken.com", + "numerai.tech", + "decentraiand.org", + "blockcrein.info", + "blockchealn.info", + "bllookchain.info", + "blockcbhain.info", + "myetherwallet.com.ethpromonodes.com", + "mettamask.io", + "tokenswap.org", + "netherum.com", + "etherexx.org", + "etherume.io", + "ethereum.plus", + "ehtereum.org", + "etereurm.org", + "etheream.com", + "ethererum.org", + "ethereum.io", + "etherdelta-glthub.com", + "cryptoalliance.herokuapp.com", + "bitspark2.com", + "indorsetoken.com", + "iconexus.tk", + "iconexus.ml", + "iconexus.ga", + "iconexus.cf", + "etherwallet.online", + "wallet-ethereum.net", + "bitsdigit.com", + "etherswap.org", + "eos.ac", + "uasfwallet.com", + "ziber.io", + "multiply-ethereum.info", + "bittrex.comze.com", + "karbon.vacau.com", + "etherdelta.gitlhub.io", + "etherdelta.glthub.io", + "digitaldevelopersfund.vacau.com", + "district-0x.io", + "coin-dash.com", + "coindash.ru", + "district0x.net", + "aragonproject.io", + "coin-wallet.info", + "coinswallet.info", + "contribute-status.im", + "ether-api.com", + "ether-wall.com", + "mycoinwallet.net", + "ethereumchamber.com", + "ethereumchamber.net", + "ethereumchest.com", + "ethewallet.com", + "myetherwallet.com.vc", + "myetherwallet.com.pe", + "myetherwallet.us.com", + "myetherwallet.com.u0387831.cp.regruhosting.ru", + "myethereumwallet.su", + "myetherweb.com.de", + "myetherieumwallet.com", + "myetehrwallet.com", + "myeterwalet.com", + "myetherwaiiet.com", + "myetherwallet.info", + "myetherwallet.ch", + "myetherwallet.om", + "myethervallet.com", + "myetherwallet.com.cm", + "myetherwallet.com.co", + "myetherwallet.com.de", + "myetherwallet.com.gl", + "myetherwallet.com.im", + "myetherwallet.com.ua", + "secure-myetherwallet.com", + "update-myetherwallet.com", + "wwwmyetherwallet.com", + "myeatherwallet.com", + "myetharwallet.com", + "myelherwallel.com", + "myetherwaillet.com", + "myetherwaliet.com", + "myetherwallel.com", + "myetherwallet.cam", + "myetherwallet.cc", + "myetherwallet.co", + "myetherwallet.cm", + "myetherwallet.cz", + "myetherwallet.org", + "myetherwallet.tech", + "myetherwallet.top", + "myetherwallet.net", + "myetherwallet.ru.com", + "myetherwallet.com.ru", + "metherwallet.com", + "myetrerwallet.com", + "myetlerwallet.com", + "myethterwallet.com", + "myethwallet.io", + "myethterwallet.co", + "myehterwallet.co", + "myaetherwallet.com", + "myetthterwallet.com", + "myetherwallet.one", + "myelterwallet.com", + "myetherwallet.gdn", + "myetherwallt.com", + "myeterwallet.com", + "myeteherwallet.com", + "myethearwailet.com", + "myetherwallelt.com", + "myetherwallett.com", + "etherwallet.org", + "myetherewallet.com", + "myeherwallet.com", + "myethcrwallet.com", + "myetherwallet.link", + "myetherwallets.com", + "myethearwaillet.com", + "myethearwallet.com", + "myetherawllet.com", + "myethereallet.com", + "myetherswallet.com", + "myetherwalet.com", + "myetherwaller.com", + "myetherwalliet.com", + "myetherwllet.com", + "etherwallet.io", + "myetherwallet.ca", + "myetherwallet.me", + "myetherwallet.ru", + "myetherwallet.xyz", + "myetherwallte.com", + "myethirwallet.com", + "myethrewallet.com", + "etherwallet.net", + "maetherwallet.com", + "meyetherwallet.com", + "my.ether-wallet.pw", + "myehterwallet.com", + "myeitherwallet.com", + "myelherwallet.com", + "myeltherwallet.com", + "myerherwallet.com", + "myethearwalet.com", + "myetherewalle.com", + "myethervvallet.com", + "myetherwallent.com", + "myetherwallet.fm", + "myetherwalllet.com", + "myetherwalltet.com", + "myetherwollet.com", + "myetlherwalet.com", + "myetlherwallet.com", + "rnyetherwallet.com", + "etherclassicwallet.com", + "omg-omise.co", + "omise-go.com", + "omise-go.net", + "omise-omg.com", + "omise-go.io", + "tenx-tech.com", + "bitclaive.com", + "tokensale-tenx.tech", + "ubiqcoin.org", + "metamask.com", + "ethtrade.io", + "myetcwallet.com", + "account-kigo.net", + "bitcoin-wallet.net", + "blocklichan.info", + "bloclkicihan.info", + "coindash.ml", + "eos-bonus.com", + "eos-io.info", + "ether-wallet.net", + "ethereum-wallet.info", + "ethereum-wallet.net", + "ethereumchest.net", + "reservations-kigo.net", + "reservations-lodgix.com", + "secure-liverez.com", + "secure-onerooftop.com", + "settings-liverez.com", + "software-liverez.com", + "software-lodgix.com", + "unhackableetherwallets.com", + "www-myetherwallet.com", + "etherwallet.co.za", + "etherwalletchain.com", + "etherwallets.net", + "etherwallets.nl", + "my-ethwallet.com", + "my.ether-wallet.co", + "myetherwallet.com.am", + "myetherwallet.com.ht", + "myetherwalletcom.com", + "myehterwailet.com", + "xn--myetherwalle-xoc.com", + "xn--myetherwalle-44i.com", + "xn--myetherwalle-xhk.com", + "xn--myetherwallt-cfb.com", + "xn--myetherwallt-6tb.com", + "xn--myetherwallt-xub.com", + "xn--myetherwallt-ovb.com", + "xn--myetherwallt-fwb.com", + "xn--myetherwallt-5wb.com", + "xn--myetherwallt-jzi.com", + "xn--myetherwallt-2ck.com", + "xn--myetherwallt-lok.com", + "xn--myetherwallt-lsl.com", + "xn--myetherwallt-ce6f.com", + "xn--myetherwalet-mcc.com", + "xn--myetherwalet-xhf.com", + "xn--myetherwalet-lcc.com", + "xn--myetherwaet-15ba.com", + "xn--myetherwalet-whf.com", + "xn--myetherwaet-v2ea.com", + "xn--myetherwllet-59a.com", + "xn--myetherwllet-jbb.com", + "xn--myetherwllet-wbb.com", + "xn--myetherwllet-9bb.com", + "xn--myetherwllet-ncb.com", + "xn--myetherwllet-0cb.com", + "xn--myetherwllet-5nb.com", + "xn--myetherwllet-ktd.com", + "xn--myetherwllet-mre.com", + "xn--myetherwllet-76e.com", + "xn--myetherwllet-o0l.com", + "xn--myetherwllet-c45f.com", + "xn--myetherallet-ejn.com", + "xn--myethewallet-4nf.com", + "xn--myethewallet-iof.com", + "xn--myethewallet-mpf.com", + "xn--myethewallet-6bk.com", + "xn--myethewallet-i31f.com", + "xn--myethrwallet-feb.com", + "xn--myethrwallt-fbbf.com", + "xn--myethrwallet-seb.com", + "xn--myethrwallt-rbbf.com", + "xn--myethrwallet-5eb.com", + "xn--myethrwallt-3bbf.com", + "xn--myethrwallet-0tb.com", + "xn--myethrwallt-tpbf.com", + "xn--myethrwallet-rub.com", + "xn--myethrwallt-iqbf.com", + "xn--myethrwallet-ivb.com", + "xn--myethrwallt-6qbf.com", + "xn--myethrwallet-8vb.com", + "xn--myethrwallt-vrbf.com", + "xn--myethrwallet-zwb.com", + "xn--myethrwallt-ksbf.com", + "xn--myethrwallet-dzi.com", + "xn--myethrwallt-wbif.com", + "xn--myethrwallet-wck.com", + "xn--myethrwallt-skjf.com", + "xn--myethrwallet-fok.com", + "xn--myethrwallt-fvjf.com", + "xn--myethrwallet-fsl.com", + "xn--myethrwallt-fwkf.com", + "xn--myethrwallet-5d6f.com", + "xn--myethrwallt-319ef.com", + "xn--myeterwallet-ufk.com", + "xn--myeterwallet-nrl.com", + "xn--myeterwallet-von.com", + "xn--myeterwallet-jl6c.com", + "xn--myeherwallet-ooc.com", + "xn--myeherwalle-6hci.com", + "xn--myeherwallet-v4i.com", + "xn--myeherwalle-zgii.com", + "xn--myeherwallet-ohk.com", + "xn--myeherwalle-6oji.com", + "xn--mytherwallet-ceb.com", + "xn--mythrwallet-cbbc.com", + "xn--mythrwallt-c7acf.com", + "xn--mytherwallet-peb.com", + "xn--mythrwallet-obbc.com", + "xn--mythrwallt-n7acf.com", + "xn--mytherwallet-2eb.com", + "xn--mythrwallet-0bbc.com", + "xn--mythrwallt-y7acf.com", + "xn--mytherwallet-xtb.com", + "xn--mythrwallet-qpbc.com", + "xn--mythrwallt-jlbcf.com", + "xn--mytherwallet-oub.com", + "xn--mythrwallet-fqbc.com", + "xn--mythrwallt-5lbcf.com", + "xn--mythrwallet-3qbc.com", + "xn--mythrwallt-smbcf.com", + "xn--mytherwallet-5vb.com", + "xn--mythrwallet-srbc.com", + "xn--mythrwallt-fnbcf.com", + "xn--mytherwallet-wwb.com", + "xn--mythrwallet-hsbc.com", + "xn--mythrwallt-1nbcf.com", + "xn--mytherwallet-9yi.com", + "xn--mythrwallet-tbic.com", + "xn--mythrwallt-dnhcf.com", + "xn--mytherwallet-tck.com", + "xn--mythrwallet-pkjc.com", + "xn--mythrwallt-lsicf.com", + "xn--mytherwallet-cok.com", + "xn--mythrwallet-cvjc.com", + "xn--mythrwallt-c2icf.com", + "xn--mytherwallet-csl.com", + "xn--mythrwallet-cwkc.com", + "xn--mythrwallt-c0jcf.com", + "xn--mytherwallet-2d6f.com", + "xn--mythrwallet-019ec.com", + "xn--mythrwallt-yq3ecf.com", + "xn--metherwallet-qlb.com", + "xn--metherwallet-1uf.com", + "xn--metherwallet-iyi.com", + "xn--metherwallet-zhk.com", + "xn--metherwallet-3ml.com", + "xn--mytherwallet-fvb.com", + "xn--myetherwallt-7db.com", + "xn--myetherwallt-leb.com", + "xn--myetherwallt-yeb.com", + "xn--yetherwallet-vjf.com", + "xn--yetherwallet-dfk.com", + "xn--yetherwallet-1t1f.com", + "xn--yetherwallet-634f.com", + "xn--myeherwallet-fpc.com", + "xn--myethewallt-crb.com", + "xn--metherwallet-1vc.com", + "xn--myeherwallt-kbb8039g.com", + "xn--myeherwallet-vk5f.com", + "xn--yethewallet-iw8ejl.com", + "xn--bittrx-th8b.com", + "xn--polniex-n0a.com", + "thekey.vin", + "thekey-vip.com", + "digitexftures.com", + "ethzero-wallet.org", + "zeepln.io", + "wepowers.network", + "wepower.vision" + ] +} diff --git a/test/unit/blacklist-controller-test.js b/test/unit/blacklist-controller-test.js index a9260466f..cbf73d3e5 100644 --- a/test/unit/blacklist-controller-test.js +++ b/test/unit/blacklist-controller-test.js @@ -38,4 +38,4 @@ describe('blacklist controller', function () { assert.equal(result, false) }) }) -})
\ No newline at end of file +}) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index 3fc7f9a98..adeca9b5f 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -1,129 +1,103 @@ const assert = require('assert') const sinon = require('sinon') const clone = require('clone') +const nock = require('nock') const MetaMaskController = require('../../app/scripts/metamask-controller') +const blacklistJSON = require('../stub/blacklist') const firstTimeState = require('../../app/scripts/first-time-state') -const BN = require('ethereumjs-util').BN -const GWEI_BN = new BN('1000000000') describe('MetaMaskController', function () { - const noop = () => {} - const metamaskController = new MetaMaskController({ - showUnconfirmedMessage: noop, - unlockAccountMessage: noop, - showUnapprovedTx: noop, - platform: {}, - encryptor: { - encrypt: function(password, object) { - this.object = object - return Promise.resolve() - }, - decrypt: function () { - return Promise.resolve(this.object) - } - }, - // initial state - initState: clone(firstTimeState), - }) + let metamaskController + const sandbox = sinon.sandbox.create() + const noop = () => { } beforeEach(function () { - // sinon allows stubbing methods that are easily verified - this.sinon = sinon.sandbox.create() + + nock('https://api.infura.io') + .persist() + .get('/v2/blacklist') + .reply(200, blacklistJSON) + + nock('https://api.infura.io') + .persist() + .get(/.*/) + .reply(200) + + metamaskController = new MetaMaskController({ + showUnapprovedTx: noop, + encryptor: { + encrypt: function (password, object) { + this.object = object + return Promise.resolve() + }, + decrypt: function () { + return Promise.resolve(this.object) + }, + }, + initState: clone(firstTimeState), + }) + sandbox.spy(metamaskController.keyringController, 'createNewVaultAndKeychain') + sandbox.spy(metamaskController.keyringController, 'createNewVaultAndRestore') }) afterEach(function () { - // sinon requires cleanup otherwise it will overwrite context - this.sinon.restore() + nock.cleanAll() + sandbox.restore() }) - describe('Metamask Controller', function () { - assert(metamaskController) - - beforeEach(function () { - sinon.spy(metamaskController.keyringController, 'createNewVaultAndKeychain') - sinon.spy(metamaskController.keyringController, 'createNewVaultAndRestore') - }) - - afterEach(function () { - metamaskController.keyringController.createNewVaultAndKeychain.restore() - metamaskController.keyringController.createNewVaultAndRestore.restore() - }) - - describe('#getGasPrice', function () { - it('gives the 50th percentile lowest accepted gas price from recentBlocksController', async function () { - const realRecentBlocksController = metamaskController.recentBlocksController - metamaskController.recentBlocksController = { - store: { - getState: () => { - return { - recentBlocks: [ - { gasPrices: [ '0x3b9aca00', '0x174876e800'] }, - { gasPrices: [ '0x3b9aca00', '0x174876e800'] }, - { gasPrices: [ '0x174876e800', '0x174876e800' ]}, - { gasPrices: [ '0x174876e800', '0x174876e800' ]}, - ] - } - } - } - } - - const gasPrice = metamaskController.getGasPrice() - assert.equal(gasPrice, '0x3b9aca00', 'accurately estimates 50th percentile accepted gas price') - - metamaskController.recentBlocksController = realRecentBlocksController - }) - - it('gives the 1 gwei price if no blocks have been seen.', async function () { - const realRecentBlocksController = metamaskController.recentBlocksController - metamaskController.recentBlocksController = { - store: { - getState: () => { - return { - recentBlocks: [] - } + describe('#getGasPrice', function () { + it('gives the 50th percentile lowest accepted gas price from recentBlocksController', async function () { + const realRecentBlocksController = metamaskController.recentBlocksController + metamaskController.recentBlocksController = { + store: { + getState: () => { + return { + recentBlocks: [ + { gasPrices: [ '0x3b9aca00', '0x174876e800'] }, + { gasPrices: [ '0x3b9aca00', '0x174876e800'] }, + { gasPrices: [ '0x174876e800', '0x174876e800' ]}, + { gasPrices: [ '0x174876e800', '0x174876e800' ]}, + ], } - } - } - - const gasPrice = metamaskController.getGasPrice() - assert.equal(gasPrice, '0x' + GWEI_BN.toString(16), 'defaults to 1 gwei') + }, + }, + } - metamaskController.recentBlocksController = realRecentBlocksController - }) + const gasPrice = metamaskController.getGasPrice() + assert.equal(gasPrice, '0x3b9aca00', 'accurately estimates 50th percentile accepted gas price') + metamaskController.recentBlocksController = realRecentBlocksController }) + }) - describe('#createNewVaultAndKeychain', function () { - it('can only create new vault on keyringController once', async function () { - const selectStub = sinon.stub(metamaskController, 'selectFirstIdentity') - + describe('#createNewVaultAndKeychain', function () { + it('can only create new vault on keyringController once', async function () { + const selectStub = sandbox.stub(metamaskController, 'selectFirstIdentity') - const password = 'a-fake-password' + const password = 'a-fake-password' - const first = await metamaskController.createNewVaultAndKeychain(password) - const second = await metamaskController.createNewVaultAndKeychain(password) + await metamaskController.createNewVaultAndKeychain(password) + await metamaskController.createNewVaultAndKeychain(password) - assert(metamaskController.keyringController.createNewVaultAndKeychain.calledOnce) + assert(metamaskController.keyringController.createNewVaultAndKeychain.calledOnce) - selectStub.reset() - }) + selectStub.reset() }) + }) + + describe('#createNewVaultAndRestore', function () { + it('should be able to call newVaultAndRestore despite a mistake.', async function () { + + const password = 'what-what-what' + const wrongSeed = 'debris dizzy just program just float decrease vacant alarm reduce speak stadiu' + const rightSeed = 'debris dizzy just program just float decrease vacant alarm reduce speak stadium' + await metamaskController.createNewVaultAndRestore(password, wrongSeed) + .catch((e) => { + return + }) + await metamaskController.createNewVaultAndRestore(password, rightSeed) - describe('#createNewVaultAndRestore', function () { - it('should be able to call newVaultAndRestore despite a mistake.', async function () { - // const selectStub = sinon.stub(metamaskController, 'selectFirstIdentity') - - const password = 'what-what-what' - const wrongSeed = 'debris dizzy just program just float decrease vacant alarm reduce speak stadiu' - const rightSeed = 'debris dizzy just program just float decrease vacant alarm reduce speak stadium' - const first = await metamaskController.createNewVaultAndRestore(password, wrongSeed) - .catch((e) => { - return - }) - const second = await metamaskController.createNewVaultAndRestore(password, rightSeed) - - assert(metamaskController.keyringController.createNewVaultAndRestore.calledTwice) - }) + assert(metamaskController.keyringController.createNewVaultAndRestore.calledTwice) }) }) }) diff --git a/test/unit/network-contoller-test.js b/test/unit/network-contoller-test.js index 0b3b5adeb..51ad09f87 100644 --- a/test/unit/network-contoller-test.js +++ b/test/unit/network-contoller-test.js @@ -1,25 +1,38 @@ const assert = require('assert') +const nock = require('nock') const NetworkController = require('../../app/scripts/controllers/network') +const { createTestProviderTools } = require('../stub/provider') +const providerResultStub = {} +const provider = createTestProviderTools({ scaffold: providerResultStub }).provider + describe('# Network Controller', function () { let networkController + const noop = () => {} const networkControllerProviderInit = { - getAccounts: () => {}, + getAccounts: noop, } beforeEach(function () { + + nock('https://api.infura.io') + .get('/*/') + .reply(200) + + nock('https://rinkeby.infura.io') + .post('/metamask') + .reply(200) + networkController = new NetworkController({ - provider: { - type: 'rinkeby', - }, + provider, }) - networkController.initializeProvider(networkControllerProviderInit, dummyProviderConstructor) + networkController.initializeProvider(networkControllerProviderInit, provider) }) describe('network', function () { describe('#provider', function () { it('provider should be updatable without reassignment', function () { - networkController.initializeProvider(networkControllerProviderInit, dummyProviderConstructor) + networkController.initializeProvider(networkControllerProviderInit, provider) const proxy = networkController._proxy proxy.setTarget({ test: true, on: () => {} }) assert.ok(proxy.test) @@ -64,21 +77,4 @@ describe('# Network Controller', function () { }) }) }) -}) - -function dummyProviderConstructor() { - return { - // provider - sendAsync: noop, - // block tracker - _blockTracker: {}, - start: noop, - stop: noop, - on: noop, - addListener: noop, - once: noop, - removeAllListeners: noop, - } -} - -function noop() {}
\ No newline at end of file +})
\ No newline at end of file |