forked from forbole/big-dipper-2.0-cosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: increment unit tests coverage (forbole#1044)
## Description Closes: #XXXX [BDU-580](https://forbole.atlassian.net/browse/BDU-580) <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] ran linting - [x] wrote tests where necessary - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] targeted the correct branch - [x] provided a link to the relevant issue or specification - [x] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed - [x] added an entry to the `CHANGELOG.md` file
- Loading branch information
Showing
187 changed files
with
6,149 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/components/avatar_name_list_msg/__snapshots__/index.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`components: AvatarNameListMsg matches snapshot 1`] = ` | ||
<a | ||
className="MuiTypography-root makeStyles-root MuiTypography-body1" | ||
href="/accounts/desmos1jrld5g998gqm4yx26l6cvhxz7y5adgxquy94nz" | ||
onClick={[Function]} | ||
onMouseEnter={[Function]} | ||
onTouchStart={[Function]} | ||
> | ||
name | ||
</a> | ||
`; | ||
|
||
exports[`components: AvatarNameListMsg matches snapshot with empty values 1`] = `null`; | ||
|
||
exports[`components: AvatarNameListMsg matches snapshot with multiple values 1`] = ` | ||
Array [ | ||
<a | ||
className="MuiTypography-root makeStyles-root MuiTypography-body1" | ||
href="/accounts/desmos1jrld5g998gqm4yx26l6cvhxz7y5adgxquy94nz" | ||
onClick={[Function]} | ||
onMouseEnter={[Function]} | ||
onTouchStart={[Function]} | ||
> | ||
name-1 | ||
</a>, | ||
" ", | ||
"and", | ||
" ", | ||
<a | ||
className="MuiTypography-root makeStyles-root MuiTypography-body1" | ||
href="/accounts/desmos1jrld5g998gqm4yx26l6cvhxz7y5adgxquy94xx" | ||
onClick={[Function]} | ||
onMouseEnter={[Function]} | ||
onTouchStart={[Function]} | ||
> | ||
name-2 | ||
</a>, | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import { MockTheme } from '@tests/utils'; | ||
import { | ||
AvatarNameListMsg, | ||
} from '@components'; | ||
|
||
// ================================== | ||
// unit tests | ||
// ================================== | ||
describe('components: AvatarNameListMsg', () => { | ||
it('matches snapshot', () => { | ||
const component = renderer.create( | ||
<MockTheme> | ||
<AvatarNameListMsg | ||
avatars={[ | ||
{ | ||
imageUrl: '', | ||
address: 'desmos1jrld5g998gqm4yx26l6cvhxz7y5adgxquy94nz', | ||
name: 'name', | ||
}, | ||
|
||
]} | ||
/> | ||
</MockTheme>, | ||
); | ||
const tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('matches snapshot with empty values', () => { | ||
const component = renderer.create( | ||
<MockTheme> | ||
<AvatarNameListMsg | ||
avatars={[]} | ||
/> | ||
</MockTheme>, | ||
); | ||
const tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('matches snapshot with multiple values', () => { | ||
const component = renderer.create( | ||
<MockTheme> | ||
<AvatarNameListMsg | ||
avatars={[ | ||
{ | ||
imageUrl: '', | ||
address: 'desmos1jrld5g998gqm4yx26l6cvhxz7y5adgxquy94nz', | ||
name: 'name-1', | ||
}, | ||
{ | ||
imageUrl: '', | ||
address: 'desmos1jrld5g998gqm4yx26l6cvhxz7y5adgxquy94xx', | ||
name: 'name-2', | ||
}, | ||
]} | ||
/> | ||
</MockTheme>, | ||
); | ||
const tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
}); |
65 changes: 65 additions & 0 deletions
65
src/components/condition_explanation/__snapshots__/index.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`components: ConditionExplanation matches snapshot 1`] = ` | ||
<div | ||
className="makeStyles-root" | ||
> | ||
<p | ||
className="MuiTypography-root MuiTypography-body1" | ||
> | ||
conditionExplanation | ||
</p> | ||
<div | ||
className="makeStyles-itemWrapper" | ||
> | ||
<div | ||
className="makeStyles-item" | ||
> | ||
<p | ||
className="MuiTypography-root MuiTypography-body1" | ||
> | ||
90% - 100% | ||
</p> | ||
<div | ||
className="makeStyles-condition green" | ||
/> | ||
</div> | ||
<div | ||
className="makeStyles-item" | ||
> | ||
<p | ||
className="MuiTypography-root MuiTypography-body1" | ||
> | ||
70% - 90% | ||
</p> | ||
<div | ||
className="makeStyles-condition yellow" | ||
/> | ||
</div> | ||
<div | ||
className="makeStyles-item" | ||
> | ||
<p | ||
className="MuiTypography-root MuiTypography-body1" | ||
> | ||
1% - 70% | ||
</p> | ||
<div | ||
className="makeStyles-condition red" | ||
/> | ||
</div> | ||
<div | ||
className="makeStyles-item" | ||
> | ||
<p | ||
className="MuiTypography-root MuiTypography-body1" | ||
> | ||
0% | ||
</p> | ||
<div | ||
className="makeStyles-condition" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import { MockTheme } from '@tests/utils'; | ||
import ConditionExplanation from '.'; | ||
|
||
// ================================== | ||
// unit tests | ||
// ================================== | ||
describe('components: ConditionExplanation', () => { | ||
it('matches snapshot', () => { | ||
const component = renderer.create( | ||
<MockTheme> | ||
<ConditionExplanation /> | ||
</MockTheme>, | ||
); | ||
const tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
}); |
116 changes: 116 additions & 0 deletions
116
src/components/custom_tool_tip/__snapshots__/index.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`component: CustomToolTip matches snapshot 1`] = ` | ||
<div | ||
className="recharts-wrapper" | ||
style={ | ||
Object { | ||
"cursor": "default", | ||
"height": 100, | ||
"position": "relative", | ||
"width": 200, | ||
} | ||
} | ||
> | ||
<svg | ||
className="recharts-surface" | ||
cx="50%" | ||
cy={100} | ||
height={100} | ||
version="1.1" | ||
viewBox="0 0 200 100" | ||
width={200} | ||
> | ||
<defs> | ||
<clipPath | ||
id="recharts1-clip" | ||
> | ||
<rect | ||
height={90} | ||
width={190} | ||
x={5} | ||
y={5} | ||
/> | ||
</clipPath> | ||
</defs> | ||
<g | ||
className="recharts-layer recharts-pie" | ||
> | ||
<g | ||
className="recharts-layer recharts-pie-sector" | ||
onMouseEnter={[Function]} | ||
onMouseLeave={[Function]} | ||
> | ||
<path | ||
className="recharts-sector" | ||
cx={100} | ||
cy={95} | ||
d="M 10,94.99999999999999 | ||
A 90,90,0, | ||
0,1, | ||
152.90067270632255,22.188470506254717 | ||
L 100,95 Z" | ||
fill="#5451CB" | ||
name={0} | ||
stroke="none" | ||
/> | ||
</g> | ||
<g | ||
className="recharts-layer recharts-pie-sector" | ||
onMouseEnter={[Function]} | ||
onMouseLeave={[Function]} | ||
> | ||
<path | ||
className="recharts-sector" | ||
cx={100} | ||
cy={95} | ||
d="M 152.90067270632255,22.188470506254717 | ||
A 90,90,0, | ||
0,1, | ||
172.81152949374524,42.099327293677405 | ||
L 100,95 Z" | ||
fill="#773CAA" | ||
name={1} | ||
stroke="none" | ||
/> | ||
</g> | ||
<g | ||
className="recharts-layer recharts-pie-sector" | ||
onMouseEnter={[Function]} | ||
onMouseLeave={[Function]} | ||
> | ||
<path | ||
className="recharts-sector" | ||
cx={100} | ||
cy={95} | ||
d="M 172.81152949374524,42.099327293677405 | ||
A 90,90,0, | ||
0,1, | ||
190,94.99999999999997 | ||
L 100,95 Z" | ||
fill="CA4D4D" | ||
name={2} | ||
stroke="none" | ||
/> | ||
</g> | ||
</g> | ||
</svg> | ||
<div | ||
className="recharts-tooltip-wrapper" | ||
style={ | ||
Object { | ||
"MozTransform": "translate(undefinedpx, undefinedpx)", | ||
"OTransform": "translate(undefinedpx, undefinedpx)", | ||
"WebkitTransform": "translate(undefinedpx, undefinedpx)", | ||
"left": 0, | ||
"msTransform": "translate(undefinedpx, undefinedpx)", | ||
"pointerEvents": "none", | ||
"position": "absolute", | ||
"top": 0, | ||
"transform": "translate(undefinedpx, undefinedpx)", | ||
"visibility": "hidden", | ||
} | ||
} | ||
/> | ||
</div> | ||
`; |
Oops, something went wrong.