From 8b62a8bec288120eee71523886f4c2df83b136ff Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 18 Apr 2016 11:31:06 -0700 Subject: Fix plugin tests --- package.json | 3 ++- test/helper.js | 3 +++ test/unit/migrations-test.js | 13 ++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index db0e2823a..f6bde2e4e 100644 --- a/package.json +++ b/package.json @@ -41,13 +41,14 @@ "metamask-logo": "^1.1.5", "multiplex": "^6.7.0", "pojo-migrator": "^2.1.0", + "polyfill-crypto.getrandomvalues": "^1.0.0", "pumpify": "^1.3.4", "react": "^0.14.3", "react-addons-css-transition-group": "^0.14.7", "react-dom": "^0.14.3", "react-hyperscript": "^2.2.2", - "readable-stream": "^2.0.5", "react-redux": "^4.0.3", + "readable-stream": "^2.0.5", "redux": "^3.0.5", "redux-logger": "^2.3.1", "redux-thunk": "^1.0.2", diff --git a/test/helper.js b/test/helper.js index 4c7f8b4c6..64fe5bd07 100644 --- a/test/helper.js +++ b/test/helper.js @@ -1,2 +1,5 @@ require('jsdom-global')() window.localStorage = {} + +if (!('crypto' in window)) { window.crypto = {} } +window.crypto.getRandomValues = require('polyfill-crypto.getrandomvalues') diff --git a/test/unit/migrations-test.js b/test/unit/migrations-test.js index 3a3213ac5..3429ffb1d 100644 --- a/test/unit/migrations-test.js +++ b/test/unit/migrations-test.js @@ -1,14 +1,17 @@ +var assert = require('assert') var test = require('tape') var path = require('path') var wallet1 = require(path.join('..', 'lib', 'migrations', '001.json')) var migration2 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '002')) -test('wallet1 is migrated successfully', function(t) { - - var result = migration2.migrate(wallet1.data) - t.equal(result.config.provider.type, 'rpc', 'provider should be rpc') - t.equal(result.config.provider.rpcTarget, 'https://rpc.metamask.io/', 'provider should be our rpc') +describe('wallet1 is migrated successfully', function() { + it('should convert etherscan provider', function(done) { + var result = migration2.migrate(wallet1.data) + assert.equal(result.config.provider.type, 'rpc', 'provider should be rpc') + assert.equal(result.config.provider.rpcTarget, 'https://rpc.metamask.io/', 'provider should be our rpc') + done() + }) }) -- cgit