1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 08:09:15 +01:00
metamask-extension/test/unit/actions/save_account_label_test.js

36 lines
959 B
JavaScript
Raw Normal View History

2017-05-04 23:35:10 +02:00
// var jsdom = require('mocha-jsdom')
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'))
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 () {
var initialState = {
metamask: {
identities: {
foo: {
2017-05-04 23:35:10 +02:00
name: 'bar',
},
},
2017-05-04 23:35:10 +02:00
},
}
freeze(initialState)
const action = {
type: actions.SAVE_ACCOUNT_LABEL,
value: {
account: 'foo',
2017-05-04 23:35:10 +02:00
label: 'baz',
},
}
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
})
})