@@ -78,6 +78,7 @@ describe('Rokt Forwarder', () => {
7878 self . noTargeting = options . noTargeting ;
7979 self . createLauncherCalled = true ;
8080 self . isInitialized = true ;
81+ self . sandbox = options . sandbox ;
8182
8283 return Promise . resolve ( {
8384 then : function ( callback ) {
@@ -98,6 +99,8 @@ describe('Rokt Forwarder', () => {
9899
99100 afterEach ( ( ) => {
100101 window . mParticle . forwarder . userAttributes = { } ;
102+ delete window . mParticle . forwarder . launcherOptions ;
103+ delete window . mParticle . Rokt . launcherOptions ;
101104 } ) ;
102105
103106 describe ( '#initForwarder' , ( ) => {
@@ -138,57 +141,70 @@ describe('Rokt Forwarder', () => {
138141 window . Rokt . createLauncherCalled . should . equal ( true ) ;
139142 } ) ;
140143
141- it ( 'should set optional settings from customFlags' , async ( ) => {
144+ it ( 'should set sandbox to true if sandbox is true in managerOptions' , async ( ) => {
145+ window . mParticle . Rokt . managerOptions = {
146+ sandbox : true ,
147+ } ;
148+
142149 await mParticle . forwarder . init (
143150 {
144151 accountId : '123456' ,
145152 } ,
146153 reportService . cb ,
147- true ,
148- null ,
149- { } ,
150- null ,
151- null ,
152- null ,
153- {
154- 'Rokt.integrationName' : 'customName' ,
155- 'Rokt.noFunctional' : true ,
156- 'Rokt.noTargeting' : true ,
157- }
154+ true
158155 ) ;
159156
160- var expectedIntegrationName =
161- 'mParticle_wsdkv_1.2.3_kitv_' +
162- require ( '../../package.json' ) . version +
163- '_customName' ;
157+ window . Rokt . createLauncherCalled . should . equal ( true ) ;
158+ window . Rokt . sandbox . should . equal ( true ) ;
159+ } ) ;
160+
161+ it ( 'should set sandbox to false if sandbox is false in managerOptions' , async ( ) => {
162+ window . mParticle . Rokt . managerOptions = {
163+ sandbox : false ,
164+ } ;
165+
166+ await mParticle . forwarder . init (
167+ {
168+ accountId : '123456' ,
169+ } ,
170+ reportService . cb ,
171+ true
172+ ) ;
164173
165174 window . Rokt . createLauncherCalled . should . equal ( true ) ;
166- window . Rokt . accountId . should . equal ( '123456' ) ;
167- window . Rokt . integrationName . should . equal ( expectedIntegrationName ) ;
168- window . Rokt . noFunctional . should . equal ( true ) ;
169- window . Rokt . noTargeting . should . equal ( true ) ;
175+ window . Rokt . sandbox . should . equal ( false ) ;
170176 } ) ;
171177
172- it ( 'should not set optional settings when not in customFlags' , async ( ) => {
178+ it ( 'should set optional settings from launcherOptions' , async ( ) => {
179+ window . mParticle . Rokt . launcherOptions = {
180+ integrationName : 'customName' ,
181+ noFunctional : true ,
182+ noTargeting : true ,
183+ } ;
184+
173185 await mParticle . forwarder . init (
174186 {
175187 accountId : '123456' ,
176188 } ,
177189 reportService . cb ,
178190 true ,
179191 null ,
180- { }
192+ { } ,
193+ null ,
194+ null ,
195+ null
181196 ) ;
182197
183198 var expectedIntegrationName =
184199 'mParticle_wsdkv_1.2.3_kitv_' +
185- require ( '../../package.json' ) . version ;
200+ require ( '../../package.json' ) . version +
201+ '_customName' ;
186202
187203 window . Rokt . createLauncherCalled . should . equal ( true ) ;
188204 window . Rokt . accountId . should . equal ( '123456' ) ;
189205 window . Rokt . integrationName . should . equal ( expectedIntegrationName ) ;
190- ( window . Rokt . noFunctional === undefined ) . should . equal ( true ) ;
191- ( window . Rokt . noTargeting === undefined ) . should . equal ( true ) ;
206+ window . Rokt . noFunctional . should . equal ( true ) ;
207+ window . Rokt . noTargeting . should . equal ( true ) ;
192208 } ) ;
193209
194210 it ( 'should set the filters on the forwarder' , async ( ) => {
@@ -244,7 +260,7 @@ describe('Rokt Forwarder', () => {
244260 ) ;
245261 } ) ;
246262
247- it ( 'should append custom integration name to integrationName if customFlags is passed ' , async ( ) => {
263+ it ( 'should append custom integration name to integrationName if passed in launcherOptions ' , async ( ) => {
248264 const packageVersion = require ( '../../package.json' ) . version ;
249265 const customIntegrationName = 'myCustomIntegration' ;
250266
@@ -255,6 +271,9 @@ describe('Rokt Forwarder', () => {
255271 window . mParticle . Rokt . attachKitCalled = true ;
256272 return Promise . resolve ( ) ;
257273 } ;
274+ window . mParticle . Rokt . launcherOptions = {
275+ integrationName : customIntegrationName ,
276+ } ;
258277
259278 // Simulate the forwarder appending the custom integration name
260279 window . Rokt . integrationName =
@@ -273,8 +292,7 @@ describe('Rokt Forwarder', () => {
273292 { } ,
274293 null ,
275294 null ,
276- null ,
277- { 'Rokt.integrationName' : customIntegrationName }
295+ null
278296 ) ;
279297
280298 window . Rokt . integrationName . should . equal (
0 commit comments