aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/__tests__/ducks/optionsSpec.js
blob: 620197152b53022003b030c24d3b3535bf1edaa7 (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
jest.mock('../../utils')

import reduceOptions, * as OptionsActions from '../../ducks/options'

describe('option reducer', () => {
    it('should return initial state', () => {
        expect(reduceOptions(undefined, {})).toEqual({})
    })

    it('should handle receive action', () => {
        let action = { type: OptionsActions.RECEIVE, data: 'foo' }
        expect(reduceOptions(undefined, action)).toEqual('foo')
    })

    it('should handle update action', () => {
        let action = {type: OptionsActions.UPDATE, data: {id: 1} }
        expect(reduceOptions(undefined, action)).toEqual({id: 1})
    })
})

describe('option actions', () => {
    it('should be possible to update option', () => {
        expect(reduceOptions(undefined, OptionsActions.update())).toEqual({})
    })
})