@@ -162,7 +162,7 @@ describe('useWizard', () => {
162162 } ) ;
163163
164164 test ( 'should thrown error on async nextStep' , async ( ) => {
165- const { result } = renderUseWizardHook ( ) ;
165+ const { result, waitForNextUpdate } = renderUseWizardHook ( ) ;
166166
167167 act ( ( ) => {
168168 result . current . handleStep ( ( ) => {
@@ -171,14 +171,15 @@ describe('useWizard', () => {
171171
172172 result . current . nextStep ( ) . catch ( ( error ) => {
173173 expect ( error ) . toEqual ( Error ( 'Gotcha' ) ) ;
174- expect ( result . error ) . toEqual ( Error ( 'Gotcha' ) ) ;
175174 expect ( result . current . activeStep ) . toBe ( 0 ) ;
176175 expect ( result . current . isFirstStep ) . toBe ( true ) ;
177176 } ) ;
178177 } ) ;
178+
179+ await waitForNextUpdate ( ) ;
179180 } ) ;
180181
181- test ( 'should thrown error on sync nextStep' , async ( ) => {
182+ test ( 'should thrown error on sync nextStep' , ( ) => {
182183 const { result } = renderUseWizardHook ( ) ;
183184
184185 act ( ( ) => {
@@ -189,7 +190,6 @@ describe('useWizard', () => {
189190 try {
190191 result . current . nextStep ( ) ;
191192 } catch ( error ) {
192- expect ( error ) . toEqual ( Error ( 'Sync gotcha' ) ) ;
193193 expect ( error ) . toEqual ( Error ( 'Sync gotcha' ) ) ;
194194 expect ( result . current . activeStep ) . toBe ( 0 ) ;
195195 expect ( result . current . isFirstStep ) . toBe ( true ) ;
0 commit comments