aboutsummaryrefslogtreecommitdiffstats
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
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 ++
-rw-r--r--.travis.yml6
-rw-r--r--web/package.json5
-rw-r--r--web/src/js/__tests__/ducks/settingsSpec.js26
3 files changed, 35 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml
index e64bf6d4..d411ac0b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -52,8 +52,10 @@ matrix:
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
- install: cd web && yarn
- script: npm test
+ install:
+ - cd web && yarn
+ - yarn global add codecov
+ script: npm test && codecov
cache:
yarn: true
directories:
diff --git a/web/package.json b/web/package.json
index f0b3ae6a..90ec031b 100644
--- a/web/package.json
+++ b/web/package.json
@@ -13,6 +13,11 @@
],
"unmockedModulePathPatterns": [
"react"
+ ],
+ "coverageDirectory":"./coverage",
+ "collectCoverage": true,
+ "coveragePathIgnorePatterns": [
+ "<rootDir>/src/js/filt/filt.js"
]
},
"dependencies": {
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({})
+ })
+})