@@ -293,27 +293,24 @@ describe('initializeExperiment', () => {
293293 // Clear exposure tracking before simulating URL change
294294 mockExposureInternal . mockClear ( ) ;
295295
296- // Ensure messageBus exists before publishing
297- if ( ( client as any ) . messageBus ) {
298- // Simulate URL change event after redirect
299- ( client as any ) . messageBus . publish ( 'url_change' , { } ) ;
296+ // Simulate URL change event after redirect
297+ ( client as any ) . messageBus . publish ( 'url_change' , { } ) ;
300298
301- // Wait for async operations to complete
302- await new Promise ( ( resolve ) => setTimeout ( resolve , 10 ) ) ;
299+ // Wait for async operations to complete
300+ await new Promise ( ( resolve ) => setTimeout ( resolve , 10 ) ) ;
303301
304- // Verify exposureInternal was called with the correct flag key
305- expect ( mockExposureInternal ) . toHaveBeenCalledTimes ( 1 ) ;
306- expect ( mockExposureInternal . mock . calls [ 0 ] [ 0 ] ) . toBe ( 'test' ) ;
302+ // Verify exposureInternal was called with the correct flag key
303+ expect ( mockExposureInternal ) . toHaveBeenCalledTimes ( 1 ) ;
304+ expect ( mockExposureInternal . mock . calls [ 0 ] [ 0 ] ) . toBe ( 'test' ) ;
307305
308- // Check that the sourceVariant parameter contains the expected properties
309- const sourceVariant : any = mockExposureInternal . mock . calls [ 0 ] [ 1 ] ;
310- expect ( sourceVariant ) . toBeDefined ( ) ;
311- expect ( sourceVariant . variant ) . toBeDefined ( ) ;
312- expect ( sourceVariant . variant . key ) . toBe ( 'treatment' ) ;
306+ // Check that the sourceVariant parameter contains the expected properties
307+ const sourceVariant : any = mockExposureInternal . mock . calls [ 0 ] [ 1 ] ;
308+ expect ( sourceVariant ) . toBeDefined ( ) ;
309+ expect ( sourceVariant . variant ) . toBeDefined ( ) ;
310+ expect ( sourceVariant . variant . key ) . toBe ( 'treatment' ) ;
313311
314- // Verify sessionStorage was cleared after tracking
315- expect ( mockGlobal . sessionStorage . getItem ( redirectStorageKey ) ) . toBeNull ( ) ;
316- }
312+ // Verify sessionStorage was cleared after tracking
313+ expect ( mockGlobal . sessionStorage . getItem ( redirectStorageKey ) ) . toBeNull ( ) ;
317314 } ) ;
318315
319316 test ( 'control variant on control page - should not redirect but call exposure' , async ( ) => {
0 commit comments