diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-11-21 06:44:12 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-11-21 06:44:12 +0800 |
commit | 764a5bac56ddc855f669495daee720288cbee200 (patch) | |
tree | 241a51d5bd149b4a4eece906cd64815a4be89828 /test/unit | |
parent | d19aa016aad6a655188f5622150ca44553856305 (diff) | |
download | tangerine-wallet-browser-764a5bac56ddc855f669495daee720288cbee200.tar tangerine-wallet-browser-764a5bac56ddc855f669495daee720288cbee200.tar.gz tangerine-wallet-browser-764a5bac56ddc855f669495daee720288cbee200.tar.bz2 tangerine-wallet-browser-764a5bac56ddc855f669495daee720288cbee200.tar.lz tangerine-wallet-browser-764a5bac56ddc855f669495daee720288cbee200.tar.xz tangerine-wallet-browser-764a5bac56ddc855f669495daee720288cbee200.tar.zst tangerine-wallet-browser-764a5bac56ddc855f669495daee720288cbee200.zip |
Get test passing
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/metamask-controller-test.js | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index 548b5f87f..e80198dda 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -11,6 +11,17 @@ describe('MetaMaskController', function () { unlockAccountMessage: noop, showUnapprovedTx: noop, platform: {}, + encryptor: { + encrypt: function(password, object) { + console.log('encrypting ', object) + this.object = object + return Promise.resolve() + }, + decrypt: function () { + console.log('decrypting') + return Promise.resolve(this.object) + } + }, // initial state initState: clone(firstTimeState), }) @@ -28,20 +39,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 expectation = sinon.mock(metamaskController.keyringController) - .expects('createNewVaultAndKeychain').once() - const password = 'a-fake-password' const first = await metamaskController.createNewVaultAndKeychain(password) + console.log('FIRST ONE RETURNED:') + console.dir(first) const second = await metamaskController.createNewVaultAndKeychain(password) + console.log('SECOND ONE RETURNED:') + console.dir(second) + + assert(metamaskController.keyringController.createNewVaultAndKeychain.calledOnce) - expectation.verify() selectStub.reset() }) }) |