Skip to content

Commit 46056ad

Browse files
committed
lint-fix
1 parent 2f2d758 commit 46056ad

File tree

3 files changed

+38
-29
lines changed

3 files changed

+38
-29
lines changed

shared/js/background/components/abn-experiments.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class PixelMetric {
9090
* Currently intercepts `epbf` pixels and triggers a `brokenSiteReport` metric.
9191
* @param {{
9292
* abnMetrics: AbnExperimentMetrics
93-
* }} opts
93+
* }} opts
9494
*/
9595
constructor({ abnMetrics }) {
9696
browser.webRequest.onCompleted.addListener(
@@ -144,12 +144,12 @@ export default class AbnExperimentMetrics {
144144

145145
/**
146146
* Triggered when a given metric is triggered.
147-
*
148-
* Checks all active, enrolled subfeature experiments to find matching metrics that should be
147+
*
148+
* Checks all active, enrolled subfeature experiments to find matching metrics that should be
149149
* sent for them. With those that match, their counter is incremented by `value`, and if they
150150
* exceed the threshold, a pixel is sent.
151-
*
152-
* After incrementing counters and potentially sending pixels, the updated cohort state is
151+
*
152+
* After incrementing counters and potentially sending pixels, the updated cohort state is
153153
* written back to settings.
154154
* @param {string} metric
155155
* @param {number} [value]

unit-test/background/abn-framework.js

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ describe('ABN pixels', () => {
241241
expect(pixelIntercept).toHaveBeenCalledTimes(2);
242242
expect(pixelRequests[1]).toContain('conversionWindowDays=0&');
243243
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+
);
245247
});
246248

247249
it('onMetricTriggered can trigger multiple matching metrics', () => {
@@ -258,8 +260,12 @@ describe('ABN pixels', () => {
258260
.filter((u) => u.startsWith('/t/experiment_metrics_'))
259261
.map((u) => new URLSearchParams(u.split('?')[1]).get('conversionWindowDays'));
260262
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+
);
263269
});
264270

265271
it('metric conversion window is inclusive of first and last days', () => {
@@ -283,33 +289,37 @@ describe('ABN pixels', () => {
283289
if (u.startsWith('/t/experiment_metrics_')) {
284290
expect(pixelValidator.validateLivePixels(experimentPixels['experiment.metrics'], 'experiment.metrics', u)).toEqual([]);
285291
}
286-
})
292+
});
287293
});
288294

289295
it('metric value count applies to conversion window only', () => {
290296
const { remoteConfig, abnMetrics } = constructMockComponents();
291297
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+
]);
308318
// modify enrollment to be 7 days ago
309319
const cohort = remoteConfig.getCohort(feature, subFeature);
310320
cohort.enrolledAt = Date.now() - 1000 * 60 * 60 * 25 * 7;
311321
remoteConfig.setCohort(feature, subFeature, cohort);
312-
pixelRequests.pop()
322+
pixelRequests.pop();
313323
// day 1 search
314324
abnMetrics.onMetricTriggered('search', 1, Date.now() - 1000 * 60 * 60 * 25 * 6);
315325
expect(pixelIntercept).toHaveBeenCalledTimes(1);
@@ -326,7 +336,7 @@ describe('ABN pixels', () => {
326336
abnMetrics.onMetricTriggered('search', 1, Date.now() - 1000 * 60 * 60 * 25 * 2);
327337
// value=1 metric was triggered on day 5
328338
expect(pixelIntercept).toHaveBeenCalledTimes(2);
329-
expect(pixelRequests.pop()).toContain('conversionWindowDays=5&value=1')
339+
expect(pixelRequests.pop()).toContain('conversionWindowDays=5&value=1');
330340
// day 6 search x2
331341
abnMetrics.onMetricTriggered('search', 1, Date.now() - 1000 * 60 * 60 * 25 * 1);
332342
abnMetrics.onMetricTriggered('search', 1, Date.now() - 1000 * 60 * 60 * 25 * 1);
@@ -335,6 +345,6 @@ describe('ABN pixels', () => {
335345
abnMetrics.onMetricTriggered('search', 1, Date.now());
336346
// value=4 metric triggers now
337347
expect(pixelIntercept).toHaveBeenCalledTimes(3);
338-
expect(pixelRequests.pop()).toContain('conversionWindowDays=5-7&value=4')
348+
expect(pixelRequests.pop()).toContain('conversionWindowDays=5-7&value=4');
339349
});
340350
});

unit-test/background/remote-config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import browser from 'webextension-polyfill';
33
import RemoteConfig from '../../shared/js/background/components/remote-config';
44
import messageHandlers from '../../shared/js/background/message-handlers';
55

6-
76
class MockSettings {
87
constructor() {
98
this.mockSettingData = new Map();

0 commit comments

Comments
 (0)