aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorThomas Huang <tmashuang@users.noreply.github.com>2017-11-28 03:37:42 +0800
committerGitHub <noreply@github.com>2017-11-28 03:37:42 +0800
commite71115735c9b9d34fe85bc9e644f3b910bdaa014 (patch)
tree847d13545af412929a2e313af9dcf1e7b2e921a9 /test
parent94fe294cafbe9bfef91f2b9c1aff4caddb35ebd3 (diff)
parentbd45022a2f04fd3d60f1e0da6963344d90aa91a1 (diff)
downloadtangerine-wallet-browser-e71115735c9b9d34fe85bc9e644f3b910bdaa014.tar.gz
tangerine-wallet-browser-e71115735c9b9d34fe85bc9e644f3b910bdaa014.tar.zst
tangerine-wallet-browser-e71115735c9b9d34fe85bc9e644f3b910bdaa014.zip
Merge pull request #2605 from MetaMask/i2577-SeedPhraseBug
Fix a possible seed phrase bug
Diffstat (limited to 'test')
-rw-r--r--test/unit/metamask-controller-test.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js
index ef6cae758..fd420a70f 100644
--- a/test/unit/metamask-controller-test.js
+++ b/test/unit/metamask-controller-test.js
@@ -11,6 +11,15 @@ describe('MetaMaskController', function () {
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),
})
@@ -27,6 +36,30 @@ describe('MetaMaskController', function () {
describe('Metamask Controller', function () {
assert(metamaskController)
+
+ beforeEach(function () {
+ sinon.spy(metamaskController.keyringController, 'createNewVaultAndKeychain')
+ })
+
+ afterEach(function () {
+ metamaskController.keyringController.createNewVaultAndKeychain.restore()
+ })
+
+ 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)
+ const second = await metamaskController.createNewVaultAndKeychain(password)
+
+ assert(metamaskController.keyringController.createNewVaultAndKeychain.calledOnce)
+
+ selectStub.reset()
+ })
+ })
})
})