diff --git a/.travis.yml b/.travis.yml index e64bf6d45..d411ac0ba 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 f0b3ae6ad..90ec031ba 100644 --- a/web/package.json +++ b/web/package.json @@ -13,6 +13,11 @@ ], "unmockedModulePathPatterns": [ "react" + ], + "coverageDirectory":"./coverage", + "collectCoverage": true, + "coveragePathIgnorePatterns": [ + "/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 000000000..cb9df9189 --- /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({}) + }) +})