@@ -51,68 +51,6 @@ describe("SetupEncryptionDialog", () => {
5151 // Then the phase has been set to Finished
5252 expect ( store . phase ) . toBe ( Phase . Finished ) ;
5353 } ) ;
54-
55- it ( "should launch a dialog when I say Proceed, then be ready when I cancel" , async ( ) => {
56- mockClient ( ) ;
57- const store = new SetupEncryptionStore ( ) ;
58- jest . spyOn ( SetupEncryptionStore , "sharedInstance" ) . mockReturnValue ( store ) ;
59-
60- // Given when you open the reset dialog we immediately cancel
61- jest . spyOn ( Modal , "createDialog" ) . mockImplementation ( ( _ , props ) => {
62- // Simulate cancelling in the dialog
63- props ?. onCancelled ( ) ;
64-
65- return {
66- close : jest . fn ( ) ,
67- finished : Promise . resolve ( [ ] ) ,
68- } ;
69- } ) ;
70-
71- // When we launch the dialog and set it ready to start
72- const onFinished = jest . fn ( ) ;
73- render ( < SetupEncryptionDialog onFinished = { onFinished } /> ) ;
74- await act ( async ( ) => await store . fetchKeyInfo ( ) ) ;
75- expect ( store . phase ) . toBe ( Phase . Intro ) ;
76-
77- // And we hit the Proceed with reset button.
78- // (The createDialog mock above simulates the user hitting cancel)
79- await act ( async ( ) => screen . getByRole ( "button" , { name : "Proceed with reset" } ) . click ( ) ) ;
80-
81- // Then the phase has been set to Intro
82- expect ( store . phase ) . toBe ( Phase . Intro ) ;
83- } ) ;
84-
85- it ( "should launch a dialog when I say Proceed, then be ready when I click outside the dialog" , async ( ) => {
86- mockClient ( ) ;
87- const store = new SetupEncryptionStore ( ) ;
88- jest . spyOn ( SetupEncryptionStore , "sharedInstance" ) . mockReturnValue ( store ) ;
89-
90- // Given when you open the reset dialog we immediately cancel
91- jest . spyOn ( Modal , "createDialog" ) . mockImplementation (
92- ( _component , _props , _className , _isPriorityModal , _isStaticModal , options ) => {
93- // Simulate clicking outside the dialog
94- options ?. onBeforeClose ?.( "backgroundClick" ) ;
95-
96- return {
97- close : jest . fn ( ) ,
98- finished : Promise . resolve ( [ ] ) ,
99- } ;
100- } ,
101- ) ;
102-
103- // When we launch the dialog and set it ready to start
104- const onFinished = jest . fn ( ) ;
105- render ( < SetupEncryptionDialog onFinished = { onFinished } /> ) ;
106- await act ( async ( ) => await store . fetchKeyInfo ( ) ) ;
107- expect ( store . phase ) . toBe ( Phase . Intro ) ;
108-
109- // And we hit the Proceed with reset button.
110- // (The createDialog mock above simulates the user clicking outside the dialog)
111- await act ( async ( ) => screen . getByRole ( "button" , { name : "Proceed with reset" } ) . click ( ) ) ;
112-
113- // Then the phase has been set to Intro
114- expect ( store . phase ) . toBe ( Phase . Intro ) ;
115- } ) ;
11654} ) ;
11755
11856function mockClient ( ) {
0 commit comments