mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
Merge pull request #2212 from MatthewShao/jest-dev
[web] Update Jest config and coverage ++
This commit is contained in:
commit
9c686ca14c
@ -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:
|
||||
|
@ -13,6 +13,11 @@
|
||||
],
|
||||
"unmockedModulePathPatterns": [
|
||||
"react"
|
||||
],
|
||||
"coverageDirectory":"./coverage",
|
||||
"collectCoverage": true,
|
||||
"coveragePathIgnorePatterns": [
|
||||
"<rootDir>/src/js/filt/filt.js"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
|
26
web/src/js/__tests__/ducks/settingsSpec.js
Normal file
26
web/src/js/__tests__/ducks/settingsSpec.js
Normal file
@ -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({})
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user