aboutsummaryrefslogtreecommitdiff
path: root/test/settings/reducers/setting.test.js
blob: 3468d4bdf820427e2efb3d06c918fc140406a4ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { expect } from "chai";
import actions from 'settings/actions';
import settingReducer from 'settings/reducers/setting';

describe("setting reducer", () => {
  it('return the initial state', () => {
    let state = settingReducer(undefined, {});
    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,
      json: '{ "key": "value" }',
      value: { key: 123 },
    };
    let state = settingReducer(undefined, action);
    expect(state).to.have.deep.property('json', '{ "key": "value" }');
    expect(state).to.have.deep.property('value', { key: 123 });
  });
});