mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +01:00
e61745a821
* eslint: Enable no-var rule * yarn lint --fix
51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
// var jsdom = require('mocha-jsdom')
|
|
const assert = require('assert')
|
|
// 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'))
|
|
|
|
describe('#unlockMetamask(selectedAccount)', function () {
|
|
beforeEach(function () {
|
|
// sinon allows stubbing methods that are easily verified
|
|
this.sinon = sinon.createSandbox()
|
|
})
|
|
|
|
afterEach(function () {
|
|
// sinon requires cleanup otherwise it will overwrite context
|
|
this.sinon.restore()
|
|
})
|
|
|
|
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,
|
|
},
|
|
}
|
|
|
|
const resultState = reducers(initialState, actions.unlockMetamask(account))
|
|
assert.equal(resultState.appState.warning, null, 'warning nullified')
|
|
})
|
|
})
|
|
|
|
describe('going home after an error', function () {
|
|
it('clears warning', function () {
|
|
const warning = 'this is the wrong warning'
|
|
// const account = 'foo_account'
|
|
const initialState = {
|
|
appState: {
|
|
warning: warning,
|
|
},
|
|
}
|
|
|
|
const resultState = reducers(initialState, actions.goHome())
|
|
assert.equal(resultState.appState.warning, null, 'warning nullified')
|
|
})
|
|
})
|
|
})
|