From 523cbb02aae08d9325c481de9eef7c651cf9c14a Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Sat, 11 Mar 2017 18:57:32 +0800 Subject: [web] Fixes all existed tests --- web/src/js/__tests__/ducks/flowsSpec.js | 3 ++- web/src/js/__tests__/ducks/ui/flowSpec.js | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'web/src/js') diff --git a/web/src/js/__tests__/ducks/flowsSpec.js b/web/src/js/__tests__/ducks/flowsSpec.js index 2b261cb1..acfa3083 100644 --- a/web/src/js/__tests__/ducks/flowsSpec.js +++ b/web/src/js/__tests__/ducks/flowsSpec.js @@ -1,13 +1,14 @@ jest.unmock('../../ducks/flows'); import reduceFlows, * as flowActions from '../../ducks/flows' +import * as storeActions from '../../ducks/utils/store' describe('select flow', () => { let state = reduceFlows(undefined, {}) for (let i of [1, 2, 3, 4]) { - state = reduceFlows(state, flowActions.addFlow({ id: i })) + state = reduceFlows(state, storeActions.add({ id: i })) } it('should be possible to select a single flow', () => { diff --git a/web/src/js/__tests__/ducks/ui/flowSpec.js b/web/src/js/__tests__/ducks/ui/flowSpec.js index f838fbaa..91b56746 100644 --- a/web/src/js/__tests__/ducks/ui/flowSpec.js +++ b/web/src/js/__tests__/ducks/ui/flowSpec.js @@ -8,7 +8,8 @@ import reducer, { setContentViewDescription, setShowFullContent, setContent, - updateEdit + updateEdit, + stopEdit } from '../../../ducks/ui/flow' import { select, updateFlow } from '../../../ducks/flows' @@ -65,12 +66,12 @@ describe('flow reducer', () => { it('should not change the state when a flow is updated which is not selected', () => { let modifiedFlow = {id: 1} let updatedFlow = {id: 0} - expect(reducer({modifiedFlow}, updateFlow(updatedFlow)).modifiedFlow).toEqual(modifiedFlow) + expect(reducer({modifiedFlow}, stopEdit(updatedFlow, modifiedFlow)).modifiedFlow).toEqual(modifiedFlow) }) - it('should stop editing when the selected flow is updated', () => { + it('should stop editing when the selected flow is updated', () => { let modifiedFlow = {id: 1} let updatedFlow = {id: 1} - expect(reducer({modifiedFlow}, updateFlow(updatedFlow)).modifiedFlow).toBeFalsy() + expect(reducer({modifiedFlow}, stopEdit(updatedFlow, modifiedFlow)).modifiedFlow).toBeFalsy() }) }) -- cgit v1.2.3