@@ -204,7 +204,6 @@ describe('SubscribeRenderer', () => {
204204 await userEvent . click ( button ) ;
205205 expect ( mockUnsubscribe ) . toBeCalledTimes ( 1 ) ;
206206 } ) ;
207-
208207 it ( 'should call unsubscribe when unmounting the component' , async ( ) => {
209208 const { unmount } = render ( < SubscribeRenderer name = 'ticks' auth = { 1 } reqData = { request_data } /> ) ;
210209 unmount ( ) ;
@@ -214,27 +213,26 @@ describe('SubscribeRenderer', () => {
214213 cleanup ( ) ;
215214 jest . clearAllMocks ( ) ;
216215
217- const setToggleModal = jest . fn ( ) ;
218- jest . spyOn ( React , 'useState' ) . mockReturnValue ( [ false , setToggleModal ] ) ;
219216 mockUseAuthContext . mockImplementation ( ( ) => ( {
220217 is_logged_in : false ,
221- is_authorized : false ,
218+ is_authorized : true ,
222219 } ) ) ;
223220 mockUseSubscription . mockImplementation ( ( ) => ( {
224221 subscribe : mockSubscribe ,
225222 unsubscribe : mockUnsubscribe ,
226223 error : { code : 'AuthorizationRequired' } ,
227224 full_response : {
228- tick : 1 ,
229- echo_req : { tick : 1 } ,
225+ app_list : 1 ,
226+ echo_req : { app_list : 1 } ,
230227 } ,
231228 } ) ) ;
232229
233230 render ( < SubscribeRenderer name = 'ticks' auth = { 1 } reqData = { request_data } /> ) ;
234- const button = await screen . findByRole ( 'button' , { name : / S e n d R e q u e s t / i } ) ;
235- await userEvent . click ( button ) ;
231+ const login_dialog = await screen . findByText (
232+ / T h i s A P I c a l l m u s t b e a u t h o r i s e d b e c a u s e i t r e q u i r e s a c c e s s t o y o u r a c c o u n t i n f o r m a t i o n ./ i,
233+ ) ;
236234 await waitFor ( ( ) => {
237- expect ( setToggleModal ) . toHaveBeenCalled ( ) ;
235+ expect ( login_dialog ) . toBeVisible ( ) ;
238236 } ) ;
239237 } ) ;
240238} ) ;
0 commit comments