Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #15 from xsky-fe/feat/add-test-coverage
Browse files Browse the repository at this point in the history
feat: Add test coverage
  • Loading branch information
wangkailang authored Jun 12, 2019
2 parents 0a1d33e + 3c95220 commit 3235b17
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,3 @@ jobs:
- stage: "Tests"
name: "Unit Tests"
script: yarn test

script:
- git config --global user.name "wangkailang"
- git config --global user.email "2418904055@qq.com"
- echo "machine github.com login wangkailang password c7202e7c76a3b7f74b48d21b370aeb594bdecf02" > ~/.netrc
- cd docs && yarn && yarn deploy && cd ..
2 changes: 2 additions & 0 deletions docs/content/components/badge.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ date: 2019-05-21
```jsx
<div>
<Badge dot size="small" text="健康" status="success"/>
<span style={{ paddingLeft: '40px' }} />
<Badge dot size="middle" text="健康" status="success"/>
<span style={{ paddingLeft: '40px' }} />
<Badge dot size="large" text="健康" status="success"/>
</div>
```
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"typescript": "3.4.5"
},
"scripts": {
"test": "react-scripts test",
"test": "react-scripts test --env=jsdom",
"coverage": "yarn test --coverage --watchAll=false",
"storybook": "start-storybook -p 6006 -c .storybook",
"build-storybook": "build-storybook -s ./stories/public -c .storybook -o build-stories"
},
Expand All @@ -43,6 +44,7 @@
"@storybook/react": "^5.0.11",
"@types/classnames": "^2.2.8",
"@types/enzyme": "^3.9.3",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/react-bootstrap": "^0.32.17",
"classnames": "^2.2.6",
"enzyme": "^3.10.0",
Expand Down
4 changes: 4 additions & 0 deletions src/components/Badge/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ describe('Badge', () => {
const badge = shallow(<Badge count="2000">UI</Badge>);
expect(badge.find('.Badge__wrapper').exists()).toEqual(true);
});
it('badge showing dot with text', () => {
const badge = shallow(<Badge dot text="关闭" status="default" />);
expect(badge.find('.Badge__dot').exists()).toEqual(true);
});
})
6 changes: 3 additions & 3 deletions src/setupTests.js → src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* https://github.com/xsky-fe/create-react-app-wizard/blob/master/packages/react-scripts/scripts/utils/createJestConfig.js#L28
* https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#testing-components
**/
import { configure } from 'enzyme';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

configure ({
adapter: new Adapter (),
Enzyme.configure ({
adapter: new Adapter(),
})

0 comments on commit 3235b17

Please sign in to comment.