Skip to content

Commit 8e1830a

Browse files
[CUTL-90] 🧹 (Base) Clean up all tests to remove warnings
1 parent 4136988 commit 8e1830a

38 files changed

+2914
-542
lines changed

‎.flowconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[ignore]
2+
<PROJECT_ROOT>/node_modules/.*
23

34
[include]
45

‎app/components/Anchor/Anchor.test.js

+5-22
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,27 @@
11
import React from 'react'
2-
import { fireEvent, render } from '@testing-library/react'
2+
import { render } from '@testing-library/react'
33
import 'jest-styled-components'
44
import { Add } from 'grommet-icons'
55

66
import Anchor from './Anchor'
77

88
const additionalProps = {
9-
a11yTitle: 'string',
10-
color: 'blue',
9+
a11yTitle: 'Link to Cuttlesoft Website',
10+
color: 'brand',
1111
disabled: false,
1212
icon: <Add />,
13-
label: 'Clickme',
14-
onClick: () => {},
15-
reverse: false,
13+
label: 'Click Me',
1614
size: 'small',
1715
}
1816

19-
const renderComponent = props =>
20-
render(
21-
<Anchor href="https://cuttlesoft.com" {...props}>
22-
<h1>Test</h1>
23-
</Anchor>,
24-
)
17+
const renderComponent = props => render(<Anchor href="https://cuttlesoft.com" {...props} />)
2518

2619
/**
2720
*
2821
* Tests for Anchor
2922
*
30-
* @see https://github.com/react-boilerplate/react-boilerplate/tree/master/docs/testing
31-
*
3223
*/
3324
describe('Anchor', () => {
34-
it('should handle click events', () => {
35-
const onClickSpy = jest.fn()
36-
const { container } = renderComponent({ onClick: onClickSpy })
37-
fireEvent.click(container.querySelector('a'))
38-
39-
expect(onClickSpy).toHaveBeenCalled()
40-
})
41-
4225
it('renders and matches snapshot', () => {
4326
const { container } = renderComponent(additionalProps)
4427

‎app/components/Anchor/__snapshots__/Anchor.test.js.snap

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ exports[`Anchor renders and matches snapshot 1`] = `
88
flex: 0 0 auto;
99
width: 24px;
1010
height: 24px;
11-
fill: blue;
12-
stroke: blue;
11+
fill: #7D4CDB;
12+
stroke: #7D4CDB;
1313
}
1414
1515
.c2 g {
@@ -67,7 +67,7 @@ exports[`Anchor renders and matches snapshot 1`] = `
6767
box-sizing: border-box;
6868
font-size: 14px;
6969
line-height: 20px;
70-
color: blue;
70+
color: #7D4CDB;
7171
font-weight: 600;
7272
-webkit-text-decoration: none;
7373
text-decoration: none;
@@ -81,7 +81,7 @@ exports[`Anchor renders and matches snapshot 1`] = `
8181
8282
<div>
8383
<a
84-
aria-label="string"
84+
aria-label="Link to Cuttlesoft Website"
8585
class="c0"
8686
href="https://cuttlesoft.com"
8787
>
@@ -104,7 +104,7 @@ exports[`Anchor renders and matches snapshot 1`] = `
104104
<div
105105
class="c3"
106106
/>
107-
Clickme
107+
Click Me
108108
</span>
109109
</a>
110110
</div>

‎app/components/AutoSaveFormField/AutoSaveFormField.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const AutoSaveFormField = ({ onSave, name, value, ...rest }) => {
6161

6262
return (
6363
<Box direction="row" align="end">
64-
<FormField error={getError()} fill="horizontal" name={name} value={value} {...rest} />
64+
<FormField error={getError()} fill="horizontal" name={name} value={{ value }} {...rest} />
6565
<Status />
6666
</Box>
6767
)

‎app/components/AutoSaveFormField/AutoSaveFormField.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import AutoSaveFormField from './AutoSaveFormField'
77
const renderComponent = (props = {}) =>
88
render(
99
<TestWrapper>
10-
<AutoSaveFormField {...props} />
10+
<AutoSaveFormField name="Test Name" onSave={() => {}} value="Test Value" {...props} />
1111
</TestWrapper>,
1212
)
1313

‎app/components/AutoSaveFormField/__snapshots__/AutoSaveFormField.test.js.snap

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ exports[`AutoSaveFormField renders and matches snapshot 1`] = `
1010
>
1111
<div
1212
class="StyledBox-sc-13pk1d4-0 kCeiYn FormField__FormFieldBox-m9hood-0 eenrNp FormField__StyledFormField-g4wt0p-0 feezXd"
13+
value="Test Value"
1314
>
1415
<label
1516
class="StyledText-sc-1sadyjn-0 enbIRN"

‎app/components/Box/Box.test.js

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ const renderComponent = (props = {}) => render(<Box {...props}>{CHILDREN}</Box>)
1212
*
1313
* Tests for Box
1414
*
15-
* @see https://github.com/react-boilerplate/react-boilerplate/tree/master/docs/testing
16-
*
1715
*/
1816
describe('Box', () => {
1917
it('renders and matches snapshot', () => {

0 commit comments

Comments
 (0)