@@ -389,8 +389,10 @@ describe('RoktManager', () => {
389389 } ) ;
390390
391391 describe ( '#processMessageQueue' , ( ) => {
392- it ( 'should process the message queue if a launcher and kit are attached' , ( ) => {
393- const kit : IRoktKit = {
392+ let kit : IRoktKit ;
393+
394+ beforeEach ( ( ) => {
395+ kit = {
394396 launcher : {
395397 selectPlacements : jest . fn ( ) ,
396398 hashAttributes : jest . fn ( ) ,
@@ -404,6 +406,9 @@ describe('RoktManager', () => {
404406 setExtensionData : jest . fn ( ) ,
405407 use : jest . fn ( ) ,
406408 } ;
409+ } ) ;
410+
411+ it ( 'should process the message queue if a launcher and kit are attached' , ( ) => {
407412
408413
409414 roktManager . selectPlacements ( { } as IRoktSelectPlacementsOptions ) ;
@@ -422,21 +427,6 @@ describe('RoktManager', () => {
422427 } ) ;
423428
424429 it ( 'should call RoktManager methods (not kit methods directly) when processing queue' , ( ) => {
425- const kit : IRoktKit = {
426- launcher : {
427- selectPlacements : jest . fn ( ) ,
428- hashAttributes : jest . fn ( ) ,
429- use : jest . fn ( ) ,
430- } ,
431- filters : undefined ,
432- selectPlacements : jest . fn ( ) ,
433- hashAttributes : jest . fn ( ) ,
434- filteredUser : undefined ,
435- userAttributes : undefined ,
436- setExtensionData : jest . fn ( ) ,
437- use : jest . fn ( ) ,
438- } ;
439-
440430 // Queue some calls before kit is ready (these will be deferred)
441431 const selectOptions = { attributes : { test : 'value' } } as IRoktSelectPlacementsOptions ;
442432 const hashAttrs = { email : 'test@example.com' } ;
@@ -488,21 +478,6 @@ describe('RoktManager', () => {
488478 } ) ;
489479
490480 it ( 'should preserve RoktManager preprocessing logic when processing deferred selectPlacements calls' , ( ) => {
491- const kit : IRoktKit = {
492- launcher : {
493- selectPlacements : jest . fn ( ) ,
494- hashAttributes : jest . fn ( ) ,
495- use : jest . fn ( ) ,
496- } ,
497- filters : undefined ,
498- selectPlacements : jest . fn ( ) ,
499- hashAttributes : jest . fn ( ) ,
500- filteredUser : undefined ,
501- userAttributes : undefined ,
502- setExtensionData : jest . fn ( ) ,
503- use : jest . fn ( ) ,
504- } ;
505-
506481 // Set up placement attributes mapping to test preprocessing
507482 roktManager [ 'placementAttributesMapping' ] = [
508483 {
@@ -552,21 +527,6 @@ describe('RoktManager', () => {
552527
553528
554529 it ( 'should skip processing if method does not exist on RoktManager' , ( ) => {
555- const kit : IRoktKit = {
556- launcher : {
557- selectPlacements : jest . fn ( ) ,
558- hashAttributes : jest . fn ( ) ,
559- use : jest . fn ( ) ,
560- } ,
561- filters : undefined ,
562- selectPlacements : jest . fn ( ) ,
563- hashAttributes : jest . fn ( ) ,
564- filteredUser : undefined ,
565- userAttributes : undefined ,
566- setExtensionData : jest . fn ( ) ,
567- use : jest . fn ( ) ,
568- } ;
569-
570530 // Manually add a message with a non-existent method name
571531 roktManager [ 'queueMessage' ] ( {
572532 messageId : 'test_123' ,
0 commit comments