aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorThomas <tmashuang@gmail.com>2018-04-11 23:34:35 +0800
committerThomas <tmashuang@gmail.com>2018-04-11 23:34:35 +0800
commit30474ccd35d5d7f30ffb8dff0acc8fbc77f44731 (patch)
tree7faba807476735b30d6361e123096e76db257a83 /test
parent7aa54916d8508aababd202eef2e57bc90c6c842d (diff)
downloadtangerine-wallet-browser-30474ccd35d5d7f30ffb8dff0acc8fbc77f44731.tar
tangerine-wallet-browser-30474ccd35d5d7f30ffb8dff0acc8fbc77f44731.tar.gz
tangerine-wallet-browser-30474ccd35d5d7f30ffb8dff0acc8fbc77f44731.tar.bz2
tangerine-wallet-browser-30474ccd35d5d7f30ffb8dff0acc8fbc77f44731.tar.lz
tangerine-wallet-browser-30474ccd35d5d7f30ffb8dff0acc8fbc77f44731.tar.xz
tangerine-wallet-browser-30474ccd35d5d7f30ffb8dff0acc8fbc77f44731.tar.zst
tangerine-wallet-browser-30474ccd35d5d7f30ffb8dff0acc8fbc77f44731.zip
MM-controlller tests
Diffstat (limited to 'test')
-rw-r--r--test/unit/metamask-controller-test.js57
1 files 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)
+ })
+
+ })
+
})