1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/test/unit/reducers/unlock_vault_test.js

47 lines
1.3 KiB
JavaScript
Raw Normal View History

import assert from 'assert'
import sinon from 'sinon'
import * as actions from '../../../ui/app/store/actions'
import reducers from '../../../ui/app/ducks'
2016-05-26 00:39:18 +02:00
2017-05-04 23:35:10 +02:00
describe('#unlockMetamask(selectedAccount)', function () {
beforeEach(function () {
2016-05-26 00:39:18 +02:00
// sinon allows stubbing methods that are easily verified
this.sinon = sinon.createSandbox()
2016-05-26 00:39:18 +02:00
})
2017-05-04 23:35:10 +02:00
afterEach(function () {
2016-05-26 00:39:18 +02:00
// sinon requires cleanup otherwise it will overwrite context
this.sinon.restore()
})
2017-05-04 23:35:10 +02:00
describe('after an error', function () {
it('clears warning', function () {
2016-05-26 00:39:18 +02:00
const warning = 'this is the wrong warning'
const account = 'foo_account'
const initialState = {
appState: {
warning: warning,
2017-05-04 23:35:10 +02:00
},
2016-05-26 00:39:18 +02:00
}
const resultState = reducers(initialState, actions.unlockMetamask(account))
assert.equal(resultState.appState.warning, null, 'warning nullified')
})
})
2017-05-04 23:35:10 +02:00
describe('going home after an error', function () {
it('clears warning', function () {
2016-05-26 00:39:18 +02:00
const warning = 'this is the wrong warning'
2017-05-04 23:35:10 +02:00
// const account = 'foo_account'
2016-05-26 00:39:18 +02:00
const initialState = {
appState: {
warning: warning,
2017-05-04 23:35:10 +02:00
},
2016-05-26 00:39:18 +02:00
}
const resultState = reducers(initialState, actions.goHome())
assert.equal(resultState.appState.warning, null, 'warning nullified')
})
})
})