mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-02 10:47:14 +00:00
[web] Reach 100% coverage for ducks/settings.js
This commit is contained in:
parent
c6a16e95e8
commit
31a45ddaaa
1 changed files with 23 additions and 0 deletions
23
web/src/js/__tests__/ducks/settingsSpec.js
Normal file
23
web/src/js/__tests__/ducks/settingsSpec.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
jest.unmock('../../ducks/settings')
|
||||
jest.mock('../../utils')
|
||||
|
||||
import reduceSettings from '../../ducks/settings'
|
||||
import * 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})
|
||||
|
||||
expect(reduceSettings(undefined, SettingsActions.update())).toEqual({})
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue