A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ciphermask/test/unit/reducers/unlock_vault_test.js

51 lines
1.5 KiB

8 years ago
// var jsdom = require('mocha-jsdom')
const assert = require('assert')
8 years ago
// var freeze = require('deep-freeze-strict')
const path = require('path')
const sinon = require('sinon')
const actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'store', 'actions.js'))
const reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'ducks', 'index.js'))
8 years ago
describe('#unlockMetamask(selectedAccount)', function () {
beforeEach(function () {
// sinon allows stubbing methods that are easily verified
this.sinon = sinon.createSandbox()
})
8 years ago
afterEach(function () {
// sinon requires cleanup otherwise it will overwrite context
this.sinon.restore()
})
8 years ago
describe('after an error', function () {
it('clears warning', function () {
const warning = 'this is the wrong warning'
const account = 'foo_account'
const initialState = {
appState: {
warning: warning,
8 years ago
},
}
const resultState = reducers(initialState, actions.unlockMetamask(account))
assert.equal(resultState.appState.warning, null, 'warning nullified')
})
})
8 years ago
describe('going home after an error', function () {
it('clears warning', function () {
const warning = 'this is the wrong warning'
8 years ago
// const account = 'foo_account'
const initialState = {
appState: {
warning: warning,
8 years ago
},
}
const resultState = reducers(initialState, actions.goHome())
assert.equal(resultState.appState.warning, null, 'warning nullified')
})
})
})