@@ -23,16 +23,16 @@ describe("InputFormField", () => {
2323
2424 test ( "when errorsMessages prop set, renders with error messages" , ( ) => {
2525 // Arrange
26- const expected = faker . random . words ( ) ;
26+ const label = faker . random . words ( ) ;
2727 const firstErrorMessage = faker . random . words ( ) ;
2828 const secondErrorMessage = faker . random . words ( ) ;
2929
3030 // Act
3131 const { getByText } = render (
3232 < InputFormField
33- label = { expected }
34- onChange = { ( ) => { } }
3533 errorMessages = { [ firstErrorMessage , secondErrorMessage ] }
34+ label = { label }
35+ onChange = { ( ) => { } }
3636 />
3737 ) ;
3838
@@ -43,15 +43,15 @@ describe("InputFormField", () => {
4343
4444 test ( "when errorsMessage prop set, renders with error message" , ( ) => {
4545 // Arrange
46- const expected = faker . random . words ( ) ;
46+ const label = faker . random . words ( ) ;
4747 const testErrorMessage = faker . random . words ( ) ;
4848
4949 // Act
5050 const { getByText } = render (
5151 < InputFormField
52- label = { expected }
53- onChange = { ( ) => { } }
5452 errorMessage = { testErrorMessage }
53+ label = { label }
54+ onChange = { ( ) => { } }
5555 />
5656 ) ;
5757
@@ -61,15 +61,11 @@ describe("InputFormField", () => {
6161
6262 test ( `when isValid prop set to false, renders with ${ InvalidInputFormValueClass } class name` , ( ) => {
6363 // Arrange
64- const expected = faker . random . words ( ) ;
64+ const label = faker . random . words ( ) ;
6565
6666 // Act
6767 const { container } = render (
68- < InputFormField
69- label = { expected }
70- onChange = { ( ) => { } }
71- isValid = { false }
72- />
68+ < InputFormField isValid = { false } label = { label } onChange = { ( ) => { } } />
7369 ) ;
7470 const result = container . getElementsByClassName (
7571 InvalidInputFormValueClass
@@ -81,15 +77,11 @@ describe("InputFormField", () => {
8177
8278 test ( `when isValid prop set to true, renders without ${ InvalidInputFormValueClass } class name` , ( ) => {
8379 // Arrange
84- const expected = faker . random . words ( ) ;
80+ const label = faker . random . words ( ) ;
8581
8682 // Act
8783 const { container } = render (
88- < InputFormField
89- label = { expected }
90- onChange = { ( ) => { } }
91- isValid = { true }
92- />
84+ < InputFormField isValid = { true } label = { label } onChange = { ( ) => { } } />
9385 ) ;
9486 const result = container . getElementsByClassName (
9587 InvalidInputFormValueClass
@@ -101,16 +93,12 @@ describe("InputFormField", () => {
10193
10294 test ( "when required prop set, renders with required text" , ( ) => {
10395 // Arrange
104- const expected = faker . random . words ( ) ;
96+ const label = faker . random . words ( ) ;
10597 const requiredText = "*" ;
10698
10799 // Act
108100 const { container } = render (
109- < InputFormField
110- label = { expected }
111- onChange = { ( ) => { } }
112- required = { true }
113- />
101+ < InputFormField label = { label } onChange = { ( ) => { } } required = { true } />
114102 ) ;
115103 const htmlLabelTag = container . getElementsByTagName ( "label" ) ;
116104
@@ -120,12 +108,12 @@ describe("InputFormField", () => {
120108
121109 test ( `when showLabelForScreenReadersOnly prop set, renders with ${ ShowLabelForScreenReadersOnlyClass } class name` , ( ) => {
122110 // Arrange
123- const expected = faker . random . words ( ) ;
111+ const label = faker . random . words ( ) ;
124112
125113 // Act
126114 const { container } = render (
127115 < InputFormField
128- label = { expected }
116+ label = { label }
129117 onChange = { ( ) => { } }
130118 showLabelForScreenReadersOnly = { true }
131119 />
@@ -141,16 +129,16 @@ describe("InputFormField", () => {
141129 test ( "when onChange set, calls handler upon change" , ( ) => {
142130 // Arrange
143131 let isChecked = false ;
144- const expected = faker . random . word ( ) ;
132+ const label = faker . random . word ( ) ;
145133 const handleChange = ( ) => ( isChecked = true ) ;
146134 const inputTestId = "inputTestId" ;
147135
148136 // Act
149137 const { getByTestId } = render (
150138 < InputFormField
151- label = { expected }
152- onChange = { handleChange }
153139 inputTestId = { inputTestId }
140+ label = { label }
141+ onChange = { handleChange }
154142 />
155143 ) ;
156144
0 commit comments