aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/__tests__/ducks/flowsSpec.js
blob: 2b261cb19aab95482128c141202a58bd13b630eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
jest.unmock('../../ducks/flows');

import reduceFlows, * as flowActions from '../../ducks/flows'


describe('select flow', () => {

    let state = reduceFlows(undefined, {})
    for (let i of [1, 2, 3, 4]) {
        state = reduceFlows(state, flowActions.addFlow({ id: i }))
    }

    it('should be possible to select a single flow', () => {
        expect(reduceFlows(state, flowActions.select(2))).toEqual(
            {
                ...state,
                selected: [2],
            }
        )
    })

    it('should be possible to deselect a flow', () => {
        expect(reduceFlows({ ...state, selected: [1] }, flowActions.select())).toEqual(
            {
                ...state,
                selected: [],
            }
        )
    })
})