2017-05-04 23:35:10 +02:00
|
|
|
// var jsdom = require('mocha-jsdom')
|
2016-05-21 01:18:54 +02:00
|
|
|
var assert = require('assert')
|
|
|
|
var freeze = require('deep-freeze-strict')
|
|
|
|
var path = require('path')
|
|
|
|
|
|
|
|
var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
|
2017-05-04 23:35:10 +02:00
|
|
|
var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
|
2016-05-21 01:18:54 +02:00
|
|
|
|
2017-05-04 23:35:10 +02:00
|
|
|
describe('SAVE_ACCOUNT_LABEL', function () {
|
|
|
|
it('updates the state.metamask.identities[:i].name property of the state to the action.value.label', function () {
|
2016-05-21 01:18:54 +02:00
|
|
|
var initialState = {
|
|
|
|
metamask: {
|
|
|
|
identities: {
|
|
|
|
foo: {
|
2017-05-04 23:35:10 +02:00
|
|
|
name: 'bar',
|
|
|
|
},
|
2016-05-21 01:18:54 +02:00
|
|
|
},
|
2017-05-04 23:35:10 +02:00
|
|
|
},
|
2016-05-21 01:18:54 +02:00
|
|
|
}
|
|
|
|
freeze(initialState)
|
|
|
|
|
|
|
|
const action = {
|
|
|
|
type: actions.SAVE_ACCOUNT_LABEL,
|
|
|
|
value: {
|
|
|
|
account: 'foo',
|
2017-05-04 23:35:10 +02:00
|
|
|
label: 'baz',
|
2016-05-21 01:18:54 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
freeze(action)
|
|
|
|
|
|
|
|
var resultingState = reducers(initialState, action)
|
|
|
|
assert.equal(resultingState.metamask.identities.foo.name, action.value.label)
|
2017-05-04 23:35:10 +02:00
|
|
|
})
|
|
|
|
})
|
2016-05-21 01:18:54 +02:00
|
|
|
|