2021-02-04 19:15:23 +01:00
|
|
|
import assert from 'assert';
|
|
|
|
import freeze from 'deep-freeze-strict';
|
|
|
|
import reducers from '../../../ui/app/ducks';
|
|
|
|
import * as actionConstants from '../../../ui/app/store/actionConstants';
|
2018-04-19 05:33:51 +02:00
|
|
|
|
|
|
|
describe('SET_ACCOUNT_LABEL', function () {
|
|
|
|
it('updates the state.metamask.identities[:i].name property of the state to the action.value.label', function () {
|
|
|
|
const initialState = {
|
|
|
|
metamask: {
|
|
|
|
identities: {
|
|
|
|
foo: {
|
|
|
|
name: 'bar',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
freeze(initialState);
|
2018-04-19 05:33:51 +02:00
|
|
|
|
|
|
|
const action = {
|
2020-01-09 04:34:58 +01:00
|
|
|
type: actionConstants.SET_ACCOUNT_LABEL,
|
2018-04-19 05:33:51 +02:00
|
|
|
value: {
|
|
|
|
account: 'foo',
|
|
|
|
label: 'baz',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
freeze(action);
|
2018-04-19 05:33:51 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const resultingState = reducers(initialState, action);
|
2020-11-03 00:41:28 +01:00
|
|
|
assert.equal(
|
|
|
|
resultingState.metamask.identities.foo.name,
|
|
|
|
action.value.label,
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|