@@ -5,23 +5,11 @@ import { bindCreateFixtures } from '@/test/create-fixtures';
55import { render , screen , waitFor } from '@/test/utils' ;
66import { CardStateProvider } from '@/ui/elements/contexts' ;
77
8- const goToStep = vi . fn ( ) ;
9-
10- vi . mock ( '../elements/Wizard' , ( ) => ( {
11- useWizard : ( ) => ( {
12- activeSteps : [ ] ,
13- currentStep : undefined ,
14- currentIndex : - 1 ,
15- totalSteps : 0 ,
16- isFirstStep : true ,
17- isLastStep : false ,
18- isNested : false ,
19- goNext : vi . fn ( ) ,
20- goPrev : vi . fn ( ) ,
21- goToStep,
22- registerStep : vi . fn ( ) ,
23- unregisterStep : vi . fn ( ) ,
24- } ) ,
8+ const dispatch = vi . fn ( ) ;
9+
10+ vi . mock ( '../elements/WizardMachineContext' , ( ) => ( {
11+ useWizardMachine : ( ) => ( { dispatch } ) ,
12+ WizardMachineProvider : ( { children } : { children : React . ReactNode } ) => children ,
2513} ) ) ;
2614
2715const setProvider = vi . fn ( ) ;
@@ -70,11 +58,10 @@ const renderDialog = (
7058} ;
7159
7260const resetMocks = ( ) => {
73- goToStep . mockReset ( ) ;
61+ dispatch . mockReset ( ) ;
7462 setProvider . mockReset ( ) ;
7563 deleteEnterpriseConnection . mockReset ( ) ;
7664 deleteEnterpriseConnection . mockResolvedValue ( { } as DeletedObjectResource ) ;
77- goToStep . mockResolvedValue ( undefined ) ;
7865 connectionMockState . current = { id : 'idn_connection_1' } ;
7966} ;
8067
@@ -156,7 +143,7 @@ describe('ResetConnectionDialog', () => {
156143 expect ( deleteEnterpriseConnection ) . toHaveBeenCalledWith ( 'idn_connection_1' ) ;
157144 } ) ;
158145 expect ( setProvider ) . toHaveBeenCalledWith ( undefined ) ;
159- expect ( goToStep ) . toHaveBeenCalledWith ( 'select-provider' ) ;
146+ expect ( dispatch ) . toHaveBeenCalledWith ( { type : 'RESET' } ) ;
160147 await waitFor ( ( ) => {
161148 expect ( onClose ) . toHaveBeenCalledTimes ( 1 ) ;
162149 } ) ;
0 commit comments