diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-07 12:21:09 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-07 12:21:09 +0900 |
commit | d995ab0030522f380d165f309ffc72b582366ddb (patch) | |
tree | 69a096e9a8610ae8966af05e91355efdd27ea811 /test/reducers/completion.test.js | |
parent | 482206f6c90985011b197623854b8bfbc26ee54c (diff) | |
parent | 9fb7bf96be786acfbad97f7c76bc423a401dd657 (diff) |
Merge pull request #19 from ueokande/content-and-background-redux-completely
Refactor: full redux on content and background
Diffstat (limited to 'test/reducers/completion.test.js')
-rw-r--r-- | test/reducers/completion.test.js | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/test/reducers/completion.test.js b/test/reducers/completion.test.js deleted file mode 100644 index 79163bf..0000000 --- a/test/reducers/completion.test.js +++ /dev/null @@ -1,90 +0,0 @@ -import { expect } from "chai"; -import actions from '../../src/actions'; -import completionReducer from '../../src/reducers/completion'; - -describe("completion reducer", () => { - it ('return the initial state', () => { - let state = completionReducer(undefined, {}); - expect(state).to.have.property('groupSelection', -1); - expect(state).to.have.property('itemSelection', -1); - expect(state).to.have.deep.property('groups', []); - }); - - it ('return next state for COMPLETION_SET_ITEMS', () => { - let state = { - groupSelection: 0, - itemSelection: 0, - groups: [], - } - let action = { - type: actions.COMPLETION_SET_ITEMS, - groups: [{ - name: 'Apple', - items: [1, 2, 3] - }, { - name: 'Banana', - items: [4, 5, 6] - }] - } - state = completionReducer(state, action); - expect(state).to.have.property('groups', action.groups); - expect(state).to.have.property('groupSelection', -1); - expect(state).to.have.property('itemSelection', -1); - }); - - it ('return next state for COMPLETION_SELECT_NEXT', () => { - let action = { type: actions.COMPLETION_SELECT_NEXT }; - let state = { - groupSelection: -1, - itemSelection: -1, - groups: [{ - name: 'Apple', - items: [1, 2] - }, { - name: 'Banana', - items: [3] - }] - }; - - state = completionReducer(state, action); - expect(state).to.have.property('groupSelection', 0); - expect(state).to.have.property('itemSelection', 0); - - state = completionReducer(state, action); - expect(state).to.have.property('groupSelection', 0); - expect(state).to.have.property('itemSelection', 1); - - state = completionReducer(state, action); - state = completionReducer(state, action); - expect(state).to.have.property('groupSelection', -1); - expect(state).to.have.property('itemSelection', -1); - }); - - it ('return next state for COMPLETION_SELECT_PREV', () => { - let action = { type: actions.COMPLETION_SELECT_PREV }; - let state = { - groupSelection: -1, - itemSelection: -1, - groups: [{ - name: 'Apple', - items: [1, 2] - }, { - name: 'Banana', - items: [3] - }] - }; - - state = completionReducer(state, action); - expect(state).to.have.property('groupSelection', 1); - expect(state).to.have.property('itemSelection', 0); - - state = completionReducer(state, action); - expect(state).to.have.property('groupSelection', 0); - expect(state).to.have.property('itemSelection', 1); - - state = completionReducer(state, action); - state = completionReducer(state, action); - expect(state).to.have.property('groupSelection', -1); - expect(state).to.have.property('itemSelection', -1); - }); -}); |