File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -416,18 +416,27 @@ describe('Gtag wrapping functions', () => {
416416 'gtag'
417417 ) ;
418418 window [ 'dataLayer' ] = [ ] ;
419- ( window [ 'gtag' ] as Gtag ) ( GtagCommand . CONFIG , fakeMeasurementId , {
419+ const eventObject = {
420420 'language' : 'en'
421- } ) ;
421+ } ;
422+ ( window [ 'gtag' ] as Gtag ) (
423+ GtagCommand . CONFIG ,
424+ fakeMeasurementId ,
425+ eventObject
426+ ) ;
422427 expect ( ( window [ 'dataLayer' ] as DataLayer ) . length ) . to . equal ( 0 ) ;
423428
424429 initPromise1 . resolve ( fakeMeasurementId ) ;
425430 await promiseAllSettled ( fakeDynamicConfigPromises ) ; // Resolves dynamic config fetches.
426431 expect ( ( window [ 'dataLayer' ] as DataLayer ) . length ) . to . equal ( 0 ) ;
427432
428433 await Promise . all ( [ initPromise1 ] ) ; // Wait for resolution of Promise.all()
429- console . log ( 'DEDB datalayer:' , window [ 'dataLayer' ] ) ;
430- expect ( ( window [ 'dataLayer' ] as DataLayer ) . length ) . to . equal ( 1 ) ;
434+ const dataLayer = window [ 'dataLayer' ] as DataLayer ;
435+ expect ( dataLayer . length ) . to . equal ( 1 ) ;
436+ const data = dataLayer [ 0 ] ;
437+ expect ( data [ '0' ] ) . to . equal ( 'config' ) ;
438+ expect ( data [ '1' ] ) . to . equal ( fakeMeasurementId ) ;
439+ expect ( data [ '2' ] ) . to . equal ( eventObject ) ;
431440 } ) ;
432441
433442 it ( 'new window.gtag function does not wait when sending "config" calls if there are no pending initialization promises' , async ( ) => {
You can’t perform that action at this time.
0 commit comments