diff options
author | Matthew Shao <me@matshao.com> | 2017-06-28 22:08:30 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-06-28 22:08:30 +0800 |
commit | 7784d7cdd0caa5a118e29f58eadbe508184c88e7 (patch) | |
tree | b6e0c5208cc3824234f03035e58e7a95e79d8b06 /web/src/js/__tests__/ducks/ui | |
parent | 4e8b8bf2ceb7d31a3fc24a62caa0341105fcebe5 (diff) | |
download | mitmproxy-7784d7cdd0caa5a118e29f58eadbe508184c88e7.tar.gz mitmproxy-7784d7cdd0caa5a118e29f58eadbe508184c88e7.tar.bz2 mitmproxy-7784d7cdd0caa5a118e29f58eadbe508184c88e7.zip |
[web] Add tests for reducors of options and modal.
Diffstat (limited to 'web/src/js/__tests__/ducks/ui')
-rw-r--r-- | web/src/js/__tests__/ducks/ui/modalSpec.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/web/src/js/__tests__/ducks/ui/modalSpec.js b/web/src/js/__tests__/ducks/ui/modalSpec.js new file mode 100644 index 00000000..30c39760 --- /dev/null +++ b/web/src/js/__tests__/ducks/ui/modalSpec.js @@ -0,0 +1,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 } + ) + }) +}) |