diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-03-27 17:04:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-27 17:04:13 +0200 |
commit | 9c686ca14c3f051abd35df5b30d0d49e1f1b2824 (patch) | |
tree | d6acd5da4bc9c01fdafcefd42126011cf4eb3fe1 | |
parent | 1909778e3d0cccf5c6a936db5172c0f49061861e (diff) | |
parent | 9a604b5cfe8bc8af2d3a087372131ab50788e802 (diff) | |
download | mitmproxy-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.yml | 6 | ||||
-rw-r--r-- | web/package.json | 5 | ||||
-rw-r--r-- | web/src/js/__tests__/ducks/settingsSpec.js | 26 |
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({}) + }) +}) |