Skip to content

Commit 96a2cda

Browse files
committedJun 29, 2020
test(CarFrontPhotoStep): add tests loading
1 parent fb7686f commit 96a2cda

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed
 

‎src/components/CarFrontPhotoStep/__snapshots__/index.test.js.snap

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
exports[`CarFrontPhotoStep should render correctly 1`] = `
44
<form
5-
className="MuiBox-root MuiBox-root-2"
5+
className="MuiBox-root MuiBox-root-102"
66
data-name="form"
77
id="form"
88
name="form"
99
onSubmit={[Function]}
1010
>
1111
<fieldset
12-
className="MuiBox-root MuiBox-root-6 makeStyles-root-5"
12+
className="MuiBox-root MuiBox-root-106 makeStyles-root-105"
1313
>
1414
<h2
1515
className="MuiTypography-root MuiTypography-h2 MuiTypography-gutterBottom"
@@ -87,25 +87,26 @@ exports[`CarFrontPhotoStep should render correctly 1`] = `
8787
}
8888
>
8989
<figure
90-
className="MuiBox-root MuiBox-root-87"
90+
className="MuiBox-root MuiBox-root-187"
9191
>
9292
<div
9393
className="MuiTypography-root MuiTypography-srOnly"
9494
>
9595
<figcaption
96-
className="MuiBox-root MuiBox-root-88"
96+
className="MuiBox-root MuiBox-root-188"
9797
>
9898
Prévia da frente do veículo
9999
</figcaption>
100100
</div>
101101
<img
102102
alt="Prévia da frente do veículo"
103-
className="makeStyles-root-89"
103+
className="makeStyles-root-189"
104104
loading="lazy"
105105
src={null}
106106
/>
107107
</figure>
108108
</div>
109109
</fieldset>
110+
<progress />
110111
</form>
111112
`;

‎src/components/CarFrontPhotoStep/index.test.js

+8
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@ describe("CarFrontPhotoStep", () => {
88

99
beforeEach(() => {
1010
props = {
11+
isLoading: true,
1112
onChange: () => {},
1213
onSubmit: () => {},
1314
photoPreviewURL: null,
1415
isCarFrontPhotoValid: true,
1516
}
1617
})
1718

19+
it("should show loading", () => {
20+
render(<CarFrontPhotoStep {...props} />)
21+
22+
const element = screen.getByRole("progressbar")
23+
expect(element).toBeTruthy()
24+
})
25+
1826
it("should render correctly", () => {
1927
const tree = renderer.create(<CarFrontPhotoStep {...props} />).toJSON()
2028
expect(tree).toMatchSnapshot()

‎src/containers/CarFrontPhotoStep/__snapshots__/index.test.js.snap

+1
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,6 @@ exports[`CarFrontPhotoStep should render correctly 1`] = `
107107
</figure>
108108
</div>
109109
</fieldset>
110+
<progress />
110111
</form>
111112
`;
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const useSetLoadingState = () => jest.fn()
2+
export const useLoadingState = () => [true, jest.fn()]
23

3-
export default { useSetLoadingState }
4+
export default { useSetLoadingState, useLoadingState }

0 commit comments

Comments
 (0)
Please sign in to comment.