aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-03-27 17:04:13 +0200
committerGitHub <noreply@github.com>2017-03-27 17:04:13 +0200
commit9c686ca14c3f051abd35df5b30d0d49e1f1b2824 (patch)
treed6acd5da4bc9c01fdafcefd42126011cf4eb3fe1 /web/src/js
parent1909778e3d0cccf5c6a936db5172c0f49061861e (diff)
parent9a604b5cfe8bc8af2d3a087372131ab50788e802 (diff)
downloadmitmproxy-9c686ca14c3f051abd35df5b30d0d49e1f1b2824.tar.gz
mitmproxy-9c686ca14c3f051abd35df5b30d0d49e1f1b2824.tar.bz2
mitmproxy-9c686ca14c3f051abd35df5b30d0d49e1f1b2824.zip
Merge pull request #2212 from MatthewShao/jest-dev
[web] Update Jest config and coverage ++
Diffstat (limited to 'web/src/js')
-rw-r--r--web/src/js/__tests__/ducks/settingsSpec.js26
1 files changed, 26 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..cb9df918
--- /dev/null
+++ b/web/src/js/__tests__/ducks/settingsSpec.js
@@ -0,0 +1,26 @@
+jest.unmock('../../ducks/settings')
+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({})
+ })
+})