aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/actions
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-10-21 03:07:53 +0800
committerDan Finlay <dan@danfinlay.com>2016-10-21 03:07:53 +0800
commit0deed1775237bc8d48eb41e83b5a661b55e4b6be (patch)
treed2453cb6ef09a0c76fc413d93d1a6cd7c008f117 /test/unit/actions
parent383f8ea7dc4a264613cfe92b257878eb78438ce7 (diff)
downloadtangerine-wallet-browser-0deed1775237bc8d48eb41e83b5a661b55e4b6be.tar.gz
tangerine-wallet-browser-0deed1775237bc8d48eb41e83b5a661b55e4b6be.tar.zst
tangerine-wallet-browser-0deed1775237bc8d48eb41e83b5a661b55e4b6be.zip
Fix tests
Diffstat (limited to 'test/unit/actions')
-rw-r--r--test/unit/actions/restore_vault_test.js60
-rw-r--r--test/unit/actions/tx_test.js8
2 files changed, 4 insertions, 64 deletions
diff --git a/test/unit/actions/restore_vault_test.js b/test/unit/actions/restore_vault_test.js
deleted file mode 100644
index 7202abb70..000000000
--- a/test/unit/actions/restore_vault_test.js
+++ /dev/null
@@ -1,60 +0,0 @@
-var jsdom = require('mocha-jsdom')
-var assert = require('assert')
-var freeze = require('deep-freeze-strict')
-var path = require('path')
-var sinon = require('sinon')
-
-var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
-var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
-
-describe('#recoverFromSeed(password, seed)', function() {
-
- beforeEach(function() {
- // sinon allows stubbing methods that are easily verified
- this.sinon = sinon.sandbox.create()
- })
-
- afterEach(function() {
- // sinon requires cleanup otherwise it will overwrite context
- this.sinon.restore()
- })
-
- // stub out account manager
- actions._setKeyringController({
- recoverFromSeed(pw, seed, cb) {
- cb(null, {
- identities: {
- foo: 'bar'
- }
- })
- },
- })
-
- it('sets metamask.isUnlocked to true', function() {
- var initialState = {
- metamask: {
- isUnlocked: false,
- isInitialized: false,
- }
- }
- freeze(initialState)
-
- const restorePhrase = 'invite heavy among daring outdoor dice jelly coil stable note seat vicious'
- const password = 'foo'
- const dispatchFunc = actions.recoverFromSeed(password, restorePhrase)
-
- var dispatchStub = this.sinon.stub()
- dispatchStub.withArgs({ TYPE: actions.unlockMetamask() }).onCall(0)
- dispatchStub.withArgs({ TYPE: actions.showAccountsPage() }).onCall(1)
-
- var action
- var resultingState = initialState
- dispatchFunc((newAction) => {
- action = newAction
- resultingState = reducers(resultingState, action)
- })
-
- assert.equal(resultingState.metamask.isUnlocked, true, 'was unlocked')
- assert.equal(resultingState.metamask.isInitialized, true, 'was initialized')
- });
-});
diff --git a/test/unit/actions/tx_test.js b/test/unit/actions/tx_test.js
index e365ee3a3..1f06b1120 100644
--- a/test/unit/actions/tx_test.js
+++ b/test/unit/actions/tx_test.js
@@ -46,7 +46,7 @@ describe('tx confirmation screen', function() {
describe('cancelTx', function() {
before(function(done) {
- actions._setKeyringController({
+ actions._setBackgroundConnection({
approveTransaction(txId, cb) { cb('An error!') },
cancelTransaction(txId) { /* noop */ },
clearSeedWordCache(cb) { cb() },
@@ -75,7 +75,7 @@ describe('tx confirmation screen', function() {
before(function(done) {
alert = () => {/* noop */}
- actions._setKeyringController({
+ actions._setBackgroundConnection({
approveTransaction(txId, cb) { cb({message: 'An error!'}) },
})
@@ -96,7 +96,7 @@ describe('tx confirmation screen', function() {
describe('when there is success', function() {
it('should complete tx and go home', function() {
- actions._setKeyringController({
+ actions._setBackgroundConnection({
approveTransaction(txId, cb) { cb() },
})
@@ -135,7 +135,7 @@ describe('tx confirmation screen', function() {
}
freeze(initialState)
- actions._setKeyringController({
+ actions._setBackgroundConnection({
approveTransaction(txId, cb) { cb() },
})