diff options
author | Matthew Shao <me@matshao.com> | 2017-03-15 08:27:42 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-03-15 08:27:42 +0800 |
commit | 48fe32766cc5f137fbfd79315e8041d24418105d (patch) | |
tree | 7a74f71d56f2760483a350d5f63e41817f594a52 /web/src/js/__tests__ | |
parent | eba6d4359cdf147b378ffa5eb66b12fc9249bc69 (diff) | |
download | mitmproxy-48fe32766cc5f137fbfd79315e8041d24418105d.tar.gz mitmproxy-48fe32766cc5f137fbfd79315e8041d24418105d.tar.bz2 mitmproxy-48fe32766cc5f137fbfd79315e8041d24418105d.zip |
[web] Reach 100% coverage for ducks/ui/flow.js
Diffstat (limited to 'web/src/js/__tests__')
-rw-r--r-- | web/src/js/__tests__/ducks/ui/flowSpec.js | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/web/src/js/__tests__/ducks/ui/flowSpec.js b/web/src/js/__tests__/ducks/ui/flowSpec.js index 91b56746..e994624d 100644 --- a/web/src/js/__tests__/ducks/ui/flowSpec.js +++ b/web/src/js/__tests__/ducks/ui/flowSpec.js @@ -9,12 +9,28 @@ import reducer, { setShowFullContent, setContent, updateEdit, - stopEdit + stopEdit, + setContentView, + selectTab, + displayLarge } from '../../../ducks/ui/flow' import { select, updateFlow } from '../../../ducks/flows' describe('flow reducer', () => { + it('should return initial state', () => { + expect(reducer(undefined, {})).toEqual({ + displayLarge: false, + viewDescription: '', + showFullContent: false, + modifiedFlow: false, + contentView: 'Auto', + tab: 'request', + content: [], + maxContentLines: 80, + }) + }) + it('should change to edit mode', () => { let testFlow = {flow : 'foo'} const newState = reducer(undefined, startEdit({ flow: 'foo' })) @@ -74,4 +90,21 @@ describe('flow reducer', () => { let updatedFlow = {id: 1} expect(reducer({modifiedFlow}, stopEdit(updatedFlow, modifiedFlow)).modifiedFlow).toBeFalsy() }) + + it('should set content view', () => { + let state = reducer(undefined, setContentView('Edit')) + expect(state.contentView).toEqual('Edit') + expect(state.showFullContent).toBeTruthy() + }) + + it('should select different tabs', () => { + let state = reducer(undefined, selectTab('response')) + expect(state.tab).toEqual('response') + expect(state.displayLarge).toBeFalsy() + expect(state.showFullContent).toBeFalsy() + }) + + it('should display large', () => { + expect(reducer(undefined, displayLarge()).displayLarge).toBeTruthy() + }) }) |