parse json in settings

This commit is contained in:
Shin'ya Ueoka 2017-10-09 15:30:05 +09:00
parent 355c0c6457
commit c913dcdec7
7 changed files with 24 additions and 28 deletions

View file

@ -5,18 +5,18 @@ import settingReducer from 'settings/reducers/setting';
describe("setting reducer", () => {
it('return the initial state', () => {
let state = settingReducer(undefined, {});
expect(state).to.have.deep.property('settings', {});
expect(state).to.have.deep.property('json', '');
expect(state).to.have.deep.property('value', {});
});
it('return next state for SETTING_SET_SETTINGS', () => {
let action = {
type: actions.SETTING_SET_SETTINGS,
settings: { value1: 'hello', value2: 'world' },
json: '{ "key": "value" }',
value: { key: 123 },
};
let state = settingReducer(undefined, action);
expect(state).to.have.deep.property('settings', {
value1: 'hello',
value2: 'world',
});
expect(state).to.have.deep.property('json', '{ "key": "value" }');
expect(state).to.have.deep.property('value', { key: 123 });
});
});