diff options
Diffstat (limited to 'web/src/js/__tests__/ducks/ui.js')
-rw-r--r-- | web/src/js/__tests__/ducks/ui.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/web/src/js/__tests__/ducks/ui.js b/web/src/js/__tests__/ducks/ui.js new file mode 100644 index 00000000..ee1a008d --- /dev/null +++ b/web/src/js/__tests__/ducks/ui.js @@ -0,0 +1,34 @@ +jest.unmock("../../ducks/ui"); + +import reducer, {setActiveMenu, SELECT_FLOW} from '../../ducks/ui'; + + +describe("ui reducer", () => { + it("should return the initial state", () => { + expect(reducer(undefined, {})).toEqual({ activeMenu: 'Start'}) + }), + it("should return the state for view", () => { + expect(reducer(undefined, setActiveMenu('View'))).toEqual({ activeMenu: 'View'}) + }), + it("should change the state to Start", () => { + expect(reducer({activeMenu: 'Flow'}, + { type: SELECT_FLOW, + currentSelection: '1', + flowId : undefined + })).toEqual({ activeMenu: 'Start'}) + }), + it("should change the state to Flow", () => { + expect(reducer({activeMenu: 'Start'}, + { type: SELECT_FLOW, + currentSelection: undefined, + flowId : '1' + })).toEqual({ activeMenu: 'Flow'}) + }), + it("should not change the state", () => { + expect(reducer({activeMenu: 'Options'}, + { type: SELECT_FLOW, + currentSelection: '1', + flowId : '2' + })).toEqual({ activeMenu: 'Options'}) + }) +}); |