@@ -241,7 +241,9 @@ describe('ABN pixels', () => {
241
241
expect ( pixelIntercept ) . toHaveBeenCalledTimes ( 2 ) ;
242
242
expect ( pixelRequests [ 1 ] ) . toContain ( 'conversionWindowDays=0&' ) ;
243
243
expect ( pixelRequests [ 1 ] ) . toContain ( 'value=1&' ) ;
244
- expect ( pixelValidator . validateLivePixels ( experimentPixels [ 'experiment.metrics' ] , 'experiment.metrics' , pixelRequests [ 1 ] ) ) . toEqual ( [ ] ) ;
244
+ expect ( pixelValidator . validateLivePixels ( experimentPixels [ 'experiment.metrics' ] , 'experiment.metrics' , pixelRequests [ 1 ] ) ) . toEqual (
245
+ [ ] ,
246
+ ) ;
245
247
} ) ;
246
248
247
249
it ( 'onMetricTriggered can trigger multiple matching metrics' , ( ) => {
@@ -258,8 +260,12 @@ describe('ABN pixels', () => {
258
260
. filter ( ( u ) => u . startsWith ( '/t/experiment_metrics_' ) )
259
261
. map ( ( u ) => new URLSearchParams ( u . split ( '?' ) [ 1 ] ) . get ( 'conversionWindowDays' ) ) ;
260
262
expect ( sentConversionWindows ) . toEqual ( [ '6' , '5-7' ] ) ;
261
- expect ( pixelValidator . validateLivePixels ( experimentPixels [ 'experiment.metrics' ] , 'experiment.metrics' , pixelRequests [ 1 ] ) ) . toEqual ( [ ] ) ;
262
- expect ( pixelValidator . validateLivePixels ( experimentPixels [ 'experiment.metrics' ] , 'experiment.metrics' , pixelRequests [ 2 ] ) ) . toEqual ( [ ] ) ;
263
+ expect ( pixelValidator . validateLivePixels ( experimentPixels [ 'experiment.metrics' ] , 'experiment.metrics' , pixelRequests [ 1 ] ) ) . toEqual (
264
+ [ ] ,
265
+ ) ;
266
+ expect ( pixelValidator . validateLivePixels ( experimentPixels [ 'experiment.metrics' ] , 'experiment.metrics' , pixelRequests [ 2 ] ) ) . toEqual (
267
+ [ ] ,
268
+ ) ;
263
269
} ) ;
264
270
265
271
it ( 'metric conversion window is inclusive of first and last days' , ( ) => {
@@ -283,33 +289,37 @@ describe('ABN pixels', () => {
283
289
if ( u . startsWith ( '/t/experiment_metrics_' ) ) {
284
290
expect ( pixelValidator . validateLivePixels ( experimentPixels [ 'experiment.metrics' ] , 'experiment.metrics' , u ) ) . toEqual ( [ ] ) ;
285
291
}
286
- } )
292
+ } ) ;
287
293
} ) ;
288
294
289
295
it ( 'metric value count applies to conversion window only' , ( ) => {
290
296
const { remoteConfig, abnMetrics } = constructMockComponents ( ) ;
291
297
remoteConfig . updateConfig ( mockExperimentConfig ) ;
292
- abnMetrics . markExperimentEnrolled ( feature , subFeature , [ {
293
- metric : 'search' ,
294
- conversionWindowStart : 5 ,
295
- conversionWindowEnd : 7 ,
296
- value : 4
297
- } , {
298
- metric : 'search' ,
299
- conversionWindowStart : 5 ,
300
- conversionWindowEnd : 5 ,
301
- value : 1
302
- } , {
303
- metric : 'search' ,
304
- conversionWindowStart : 5 ,
305
- conversionWindowEnd : 5 ,
306
- value : 2
307
- } ] ) ;
298
+ abnMetrics . markExperimentEnrolled ( feature , subFeature , [
299
+ {
300
+ metric : 'search' ,
301
+ conversionWindowStart : 5 ,
302
+ conversionWindowEnd : 7 ,
303
+ value : 4 ,
304
+ } ,
305
+ {
306
+ metric : 'search' ,
307
+ conversionWindowStart : 5 ,
308
+ conversionWindowEnd : 5 ,
309
+ value : 1 ,
310
+ } ,
311
+ {
312
+ metric : 'search' ,
313
+ conversionWindowStart : 5 ,
314
+ conversionWindowEnd : 5 ,
315
+ value : 2 ,
316
+ } ,
317
+ ] ) ;
308
318
// modify enrollment to be 7 days ago
309
319
const cohort = remoteConfig . getCohort ( feature , subFeature ) ;
310
320
cohort . enrolledAt = Date . now ( ) - 1000 * 60 * 60 * 25 * 7 ;
311
321
remoteConfig . setCohort ( feature , subFeature , cohort ) ;
312
- pixelRequests . pop ( )
322
+ pixelRequests . pop ( ) ;
313
323
// day 1 search
314
324
abnMetrics . onMetricTriggered ( 'search' , 1 , Date . now ( ) - 1000 * 60 * 60 * 25 * 6 ) ;
315
325
expect ( pixelIntercept ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -326,7 +336,7 @@ describe('ABN pixels', () => {
326
336
abnMetrics . onMetricTriggered ( 'search' , 1 , Date . now ( ) - 1000 * 60 * 60 * 25 * 2 ) ;
327
337
// value=1 metric was triggered on day 5
328
338
expect ( pixelIntercept ) . toHaveBeenCalledTimes ( 2 ) ;
329
- expect ( pixelRequests . pop ( ) ) . toContain ( 'conversionWindowDays=5&value=1' )
339
+ expect ( pixelRequests . pop ( ) ) . toContain ( 'conversionWindowDays=5&value=1' ) ;
330
340
// day 6 search x2
331
341
abnMetrics . onMetricTriggered ( 'search' , 1 , Date . now ( ) - 1000 * 60 * 60 * 25 * 1 ) ;
332
342
abnMetrics . onMetricTriggered ( 'search' , 1 , Date . now ( ) - 1000 * 60 * 60 * 25 * 1 ) ;
@@ -335,6 +345,6 @@ describe('ABN pixels', () => {
335
345
abnMetrics . onMetricTriggered ( 'search' , 1 , Date . now ( ) ) ;
336
346
// value=4 metric triggers now
337
347
expect ( pixelIntercept ) . toHaveBeenCalledTimes ( 3 ) ;
338
- expect ( pixelRequests . pop ( ) ) . toContain ( 'conversionWindowDays=5-7&value=4' )
348
+ expect ( pixelRequests . pop ( ) ) . toContain ( 'conversionWindowDays=5-7&value=4' ) ;
339
349
} ) ;
340
350
} ) ;
0 commit comments