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

Commit

Permalink
feat: Test add
Browse files Browse the repository at this point in the history
  • Loading branch information
wangkailang committed Jun 12, 2019
1 parent 3235b17 commit a4177c3
Show file tree
Hide file tree
Showing 7 changed files with 506 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,33 @@
Add in package.json
```
"wizard-ui": "git+ssh://git@github.com:xsky-fe/wizard-ui.git"
```

## Unit Test Coverage
```
-------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
-------------------------|----------|----------|----------|----------|-------------------|
All files | 72.64 | 64.21 | 78.95 | 74.35 | |
src | 0 | 0 | 0 | 0 | |
index.ts | 0 | 0 | 0 | 0 | |
interface.tsx | 0 | 0 | 0 | 0 | |
src/components | 0 | 0 | 0 | 0 | |
index.tsx | 0 | 0 | 0 | 0 | |
src/components/Badge | 100 | 100 | 100 | 100 | |
index.tsx | 100 | 100 | 100 | 100 | |
src/components/Icon | 100 | 100 | 100 | 100 | |
index.tsx | 100 | 100 | 100 | 100 | |
src/components/Loader | 100 | 100 | 100 | 100 | |
index.tsx | 100 | 100 | 100 | 100 | |
src/components/Tooltip | 87.1 | 68.75 | 100 | 89.29 | |
index.tsx | 87.1 | 68.75 | 100 | 89.29 | 37,40,43 |
src/components/UsageBar | 90 | 83.1 | 100 | 90 | |
index.tsx | 90 | 83.1 | 100 | 90 | 16,18,20,73,74,75 |
src/utils | 49.44 | 41.38 | 60 | 51.22 | |
bem-class.ts | 70 | 55.56 | 100 | 70 | 3,6,14 |
bulk.ts | 5.26 | 0 | 0 | 5.88 |... 38,40,41,42,44 |
index.ts | 0 | 0 | 0 | 0 | |
xbytes.ts | 60 | 50.82 | 50 | 61.82 |... 06,109,114,121 |
-------------------------|----------|----------|----------|----------|-------------------|
```
46 changes: 46 additions & 0 deletions src/components/Icon/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Loader should render default ui 1`] = `
initialize {
"0": Object {
"attribs": Object {
"class": "undefined icon icon-os-search-role",
},
"children": Array [],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": null,
"parent": null,
"prev": null,
"root": Object {
"attribs": Object {},
"children": Array [
[Circular],
],
"name": "root",
"namespace": "http://www.w3.org/1999/xhtml",
"next": null,
"parent": null,
"prev": null,
"type": "root",
"x-attribsNamespace": Object {},
"x-attribsPrefix": Object {},
},
"type": "tag",
"x-attribsNamespace": Object {
"class": undefined,
},
"x-attribsPrefix": Object {
"class": undefined,
},
},
"_root": [Circular],
"length": 1,
"options": Object {
"decodeEntities": true,
"normalizeWhitespace": false,
"withDomLvl1": true,
"xml": false,
},
}
`;
10 changes: 10 additions & 0 deletions src/components/Icon/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import Icon from './index';
import { render } from 'enzyme';

describe('Loader', () => {
it('should render default ui', () => {
const icon = render(<Icon type="os-search-role"/>);
expect(icon).toMatchSnapshot();
});
})
Loading

0 comments on commit a4177c3

Please sign in to comment.