@@ -171,17 +171,23 @@ describe('createForm', () => {
171171 } ) ;
172172
173173 describe ( 'handleChange' , ( ) => {
174- it ( 'updates the form when connected to change handler of input' , ( done ) => {
175- subscribeOnce ( instance . form ) . then ( ( form ) =>
176- expect ( form . email ) . toBe ( initialValues . email ) ,
177- ) ;
174+ it ( 'updates the form when connected to change handler of input' , async ( done ) => {
178175 const email = chance . email ( ) ;
179176 const event = {
180177 target : {
181178 name : 'email' ,
182179 value : email ,
183180 } ,
184181 } ;
182+
183+ await new Promise ( ( resolve ) => {
184+ subscribeOnce ( instance . form ) . then ( ( form ) => {
185+ expect ( form . email ) . toBe ( initialValues . email ) ;
186+
187+ resolve ( ) ;
188+ } ) ;
189+ } ) ;
190+
185191 instance
186192 . handleChange ( event )
187193 . then ( ( ) => subscribeOnce ( instance . form ) )
@@ -224,7 +230,9 @@ describe('createForm', () => {
224230 instance
225231 . handleChange ( event )
226232 . then ( ( ) => subscribeOnce ( instance . errors ) )
227- . then ( errors => expect ( errors . email ) . toBe ( "email must be a valid email" ) )
233+ . then ( ( errors ) =>
234+ expect ( errors . email ) . toBe ( 'email must be a valid email' ) ,
235+ )
228236 . then ( done ) ;
229237 } ) ;
230238
@@ -436,7 +444,7 @@ describe('createForm', () => {
436444 . then ( ( errors ) => {
437445 const errorValues = nonEmpty ( Object . values ( errors ) ) ;
438446 expect ( errorValues . length ) . toBe ( 1 ) ;
439- expect ( errors . what ) . toBe ( " what is a required field" ) ;
447+ expect ( errors . what ) . toBe ( ' what is a required field' ) ;
440448 } )
441449 . then ( done ) ;
442450 } ) ;
@@ -467,8 +475,9 @@ describe('createForm', () => {
467475 beforeEach ( ( ) => {
468476 validationSchema = yup . object ( ) . shape ( {
469477 password : yup . string ( ) . required ( ) ,
470- passwordConfirmation : yup . string ( )
471- . oneOf ( [ yup . ref ( 'password' ) , null ] , "Passwords don't match!" )
478+ passwordConfirmation : yup
479+ . string ( )
480+ . oneOf ( [ yup . ref ( 'password' ) , null ] , "Passwords don't match!" ) ,
472481 } ) ;
473482 } ) ;
474483
@@ -496,7 +505,6 @@ describe('createForm', () => {
496505 . then ( done ) ;
497506 } ) ;
498507
499-
500508 it ( 'is valid when passwords match' , ( done ) => {
501509 instance = getInstance ( {
502510 initialValues : {
0 commit comments