aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/__tests__/ducks/ui/modalSpec.js
blob: 30c39760126743926e95a8388164bc1756935327 (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
import reduceModal, * as ModalActions from '../../../ducks/ui/modal'

describe('modal reducer', () => {
    let state = undefined

    it('should return the initial state', () => {
        expect(reduceModal(undefined, {})).toEqual(
            { activeModal: undefined }
        )
    })

    it('should handle setActiveModal action', () => {
        state = reduceModal(undefined, ModalActions.setActiveModal('foo'))
        expect(state).toEqual(
            { activeModal: 'foo' }
        )
    })

    it('should handle hideModal action', () => {
        state = reduceModal(state, ModalActions.hideModal())
        expect(state).toEqual(
            { activeModal: undefined }
        )
    })
})