aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2018-01-09 03:43:43 +0800
committerGitHub <noreply@github.com>2018-01-09 03:43:43 +0800
commit0cf5c22178050fff0e89af2a12d87ef7fdf4440c (patch)
tree0c512e96e6ee56dea366cbef63ace5204d90bc3c /test
parentf6f3f915707a2a4f5c9db43ae51741c7d30cbc69 (diff)
parent52bb711fa99611678d2a2e9b4098f9a6ece8adda (diff)
downloadtangerine-wallet-browser-0cf5c22178050fff0e89af2a12d87ef7fdf4440c.tar
tangerine-wallet-browser-0cf5c22178050fff0e89af2a12d87ef7fdf4440c.tar.gz
tangerine-wallet-browser-0cf5c22178050fff0e89af2a12d87ef7fdf4440c.tar.bz2
tangerine-wallet-browser-0cf5c22178050fff0e89af2a12d87ef7fdf4440c.tar.lz
tangerine-wallet-browser-0cf5c22178050fff0e89af2a12d87ef7fdf4440c.tar.xz
tangerine-wallet-browser-0cf5c22178050fff0e89af2a12d87ef7fdf4440c.tar.zst
tangerine-wallet-browser-0cf5c22178050fff0e89af2a12d87ef7fdf4440c.zip
Merge pull request #2851 from MetaMask/i2812-seedworderrorfix
Fix condition where failing seed word checks would infinite-spin future attempts.
Diffstat (limited to 'test')
-rw-r--r--test/unit/metamask-controller-test.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js
index 3deb5a1c7..9ec7cd0af 100644
--- a/test/unit/metamask-controller-test.js
+++ b/test/unit/metamask-controller-test.js
@@ -41,10 +41,12 @@ describe('MetaMaskController', function () {
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 () {
@@ -74,9 +76,9 @@ describe('MetaMaskController', function () {
describe('#createNewVaultAndKeychain', function () {
it('can only create new vault on keyringController once', async function () {
-
const selectStub = sinon.stub(metamaskController, 'selectFirstIdentity')
+
const password = 'a-fake-password'
const first = await metamaskController.createNewVaultAndKeychain(password)
@@ -87,6 +89,22 @@ describe('MetaMaskController', function () {
selectStub.reset()
})
})
+
+ 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)
+ })
+ })
})
})
-