mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 15:50:28 +01:00
92971d3c87
* Update eslint-plugin-import version * Convert JS files to use ESM * Update ESLint rules to check imports * Fix test:unit:global command env * Cleanup mock-dev script
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
import assert from 'assert'
|
|
import sinon from 'sinon'
|
|
import * as actions from '../../../ui/app/store/actions'
|
|
import reducers from '../../../ui/app/ducks'
|
|
|
|
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')
|
|
})
|
|
})
|
|
})
|