aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/__tests__/ducks/settingsSpec.js
blob: 46d56ec7416b301966e3a32f0f3093fe42509f7d (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 reduceSettings, * as SettingsActions from '../../ducks/settings'

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

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

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

describe('setting actions', () => {
    it('should be possible to update setting', () => {
        expect(reduceSettings(undefined, SettingsActions.update())).toEqual({})
    })
})