Skip to content

Commit

Permalink
feat: increment unit tests coverage (forbole#1044)
Browse files Browse the repository at this point in the history
## 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
MonikaCat authored Nov 17, 2022
1 parent 9decb57 commit a13f442
Show file tree
Hide file tree
Showing 187 changed files with 6,149 additions and 465 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Added Sentry's Next.js SDK ([\#1005](https://github.com/forbole/big-dipper-2.0-cosmos/issues/1005))
- Switched from using `npm` to `yarn berry` package manager ([\#1028](https://github.com/forbole/big-dipper-2.0-cosmos/pull/1028))
- Added message type to transactions ([\#1034](https://github.com/forbole/big-dipper-2.0-cosmos/issues/1034))
- Incremented unit tests coverage ([\#1044](https://github.com/forbole/big-dipper-2.0-cosmos/pull/1044))


# base-v2.1.2 - 2022-09-11
Expand Down
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>,
]
`;
69 changes: 69 additions & 0 deletions src/components/avatar_name_list_msg/index.test.tsx
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();
});
});
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>
`;
23 changes: 23 additions & 0 deletions src/components/condition_explanation/index.test.tsx
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 src/components/custom_tool_tip/__snapshots__/index.test.tsx.snap
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>
`;
Loading

0 comments on commit a13f442

Please sign in to comment.