diff options
author | Matthew Shao <me@matshao.com> | 2017-03-26 09:34:45 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-03-26 09:34:45 +0800 |
commit | 31a45ddaaa46d2f16b05a27b949dfd4ae09fcaa4 (patch) | |
tree | eb479b720e0c73698e48c62d02ddf10ab8e316aa /web | |
parent | c6a16e95e856c859b147e72a484feefe96c37ad9 (diff) | |
download | mitmproxy-31a45ddaaa46d2f16b05a27b949dfd4ae09fcaa4.tar.gz mitmproxy-31a45ddaaa46d2f16b05a27b949dfd4ae09fcaa4.tar.bz2 mitmproxy-31a45ddaaa46d2f16b05a27b949dfd4ae09fcaa4.zip |
[web] Reach 100% coverage for ducks/settings.js
Diffstat (limited to 'web')
-rw-r--r-- | web/src/js/__tests__/ducks/settingsSpec.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/web/src/js/__tests__/ducks/settingsSpec.js b/web/src/js/__tests__/ducks/settingsSpec.js new file mode 100644 index 00000000..325cc8e2 --- /dev/null +++ b/web/src/js/__tests__/ducks/settingsSpec.js @@ -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({}) + }) +}) |