@@ -4,17 +4,12 @@ import sinon from 'sinon';
44import { fireEvent , render , waitFor } from '@testing-library/react' ;
55import { PreSubmitInfo2 } from '../../../components/PreSubmitInfo2' ;
66
7- const buildUser = ( fullName = { first : 'John' , last : 'Doe' } ) => ( {
8- profile : { userFullName : fullName } ,
9- } ) ;
10-
117describe ( 'COE PreSubmitInfo2' , ( ) => {
128 it ( 'renders a va-statement-of-truth with the expected heading and input label' , ( ) => {
139 const { container } = render (
1410 < PreSubmitInfo2
1511 formData = { { } }
1612 showError = { false }
17- user = { buildUser ( ) }
1813 onSectionComplete = { ( ) => { } }
1914 /> ,
2015 ) ;
@@ -30,7 +25,6 @@ describe('COE PreSubmitInfo2', () => {
3025 < PreSubmitInfo2
3126 formData = { { } }
3227 showError = { false }
33- user = { buildUser ( ) }
3428 onSectionComplete = { ( ) => { } }
3529 /> ,
3630 ) ;
@@ -44,7 +38,6 @@ describe('COE PreSubmitInfo2', () => {
4438 < PreSubmitInfo2
4539 formData = { { } }
4640 showError = { false }
47- user = { buildUser ( ) }
4841 onSectionComplete = { ( ) => { } }
4942 /> ,
5043 ) ;
@@ -59,7 +52,6 @@ describe('COE PreSubmitInfo2', () => {
5952 < PreSubmitInfo2
6053 formData = { { } }
6154 showError = { false }
62- user = { buildUser ( ) }
6355 onSectionComplete = { onSectionComplete }
6456 /> ,
6557 ) ;
@@ -78,12 +70,7 @@ describe('COE PreSubmitInfo2', () => {
7870
7971 it ( 'shows a checkbox error when showError is true and the box is unchecked' , async ( ) => {
8072 const { container } = render (
81- < PreSubmitInfo2
82- formData = { { } }
83- showError
84- user = { buildUser ( ) }
85- onSectionComplete = { ( ) => { } }
86- /> ,
73+ < PreSubmitInfo2 formData = { { } } showError onSectionComplete = { ( ) => { } } /> ,
8774 ) ;
8875 await waitFor ( ( ) => {
8976 const sot = container . querySelector ( 'va-statement-of-truth' ) ;
@@ -95,12 +82,7 @@ describe('COE PreSubmitInfo2', () => {
9582
9683 it ( 'clears the checkbox error after the box is checked' , async ( ) => {
9784 const { container } = render (
98- < PreSubmitInfo2
99- formData = { { } }
100- showError
101- user = { buildUser ( ) }
102- onSectionComplete = { ( ) => { } }
103- /> ,
85+ < PreSubmitInfo2 formData = { { } } showError onSectionComplete = { ( ) => { } } /> ,
10486 ) ;
10587 const sot = container . querySelector ( 'va-statement-of-truth' ) ;
10688 fireEvent (
@@ -112,12 +94,11 @@ describe('COE PreSubmitInfo2', () => {
11294 } ) ;
11395 } ) ;
11496
115- it ( 'shows a signature mismatch error after blur when the signature does not match the profile name' , async ( ) => {
97+ it ( 'shows a signature mismatch error after blur when the signature does not match the expected name' , async ( ) => {
11698 const { container } = render (
11799 < PreSubmitInfo2
118- formData = { { } }
100+ formData = { { fullName : { first : 'John' , last : 'Doe' } } }
119101 showError = { false }
120- user = { buildUser ( { first : 'John' , last : 'Doe' } ) }
121102 onSectionComplete = { ( ) => { } }
122103 /> ,
123104 ) ;
@@ -143,7 +124,6 @@ describe('COE PreSubmitInfo2', () => {
143124 < PreSubmitInfo2
144125 formData = { { } }
145126 showError = { false }
146- user = { buildUser ( ) }
147127 onSectionComplete = { ( ) => { } }
148128 /> ,
149129 ) ;
@@ -159,12 +139,11 @@ describe('COE PreSubmitInfo2', () => {
159139 expect ( sot . getAttribute ( 'input-error' ) ) . to . be . null ;
160140 } ) ;
161141
162- it ( 'does not show a mismatch error when the signature matches the profile name (case/whitespace insensitive)' , async ( ) => {
142+ it ( 'does not show a mismatch error when the signature matches the expected name (case/whitespace insensitive)' , async ( ) => {
163143 const { container } = render (
164144 < PreSubmitInfo2
165- formData = { { } }
145+ formData = { { fullName : { first : 'John' , last : 'Doe' } } }
166146 showError
167- user = { buildUser ( { first : 'John' , last : 'Doe' } ) }
168147 onSectionComplete = { ( ) => { } }
169148 /> ,
170149 ) ;
@@ -184,13 +163,11 @@ describe('COE PreSubmitInfo2', () => {
184163 it ( 'shows a mismatch error when showError is true even if the input has not been blurred' , async ( ) => {
185164 const { container } = render (
186165 < PreSubmitInfo2
187- formData = { { } }
166+ formData = { { fullName : { first : 'John' , last : 'Doe' } } }
188167 showError
189- user = { buildUser ( ) }
190168 onSectionComplete = { ( ) => { } }
191169 /> ,
192170 ) ;
193- // empty signature mismatches profile name -> should surface the input error
194171 const sot = container . querySelector ( 'va-statement-of-truth' ) ;
195172 await waitFor ( ( ) => {
196173 expect ( sot . getAttribute ( 'input-error' ) ) . to . include ( 'John Doe' ) ;
@@ -202,7 +179,6 @@ describe('COE PreSubmitInfo2', () => {
202179 < PreSubmitInfo2
203180 formData = { { } }
204181 showError = { false }
205- user = { buildUser ( ) }
206182 onSectionComplete = { ( ) => { } }
207183 /> ,
208184 ) ;
0 commit comments