summaryrefslogtreecommitdiffstats
path: root/browser/components/asrouter/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
commit086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch)
treea4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /browser/components/asrouter/tests
parentAdding debian version 124.0.1-1. (diff)
downloadfirefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz
firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/asrouter/tests')
-rw-r--r--browser/components/asrouter/tests/browser/browser_asrouter_cfr.js66
-rw-r--r--browser/components/asrouter/tests/browser/browser_asrouter_experimentsAPILoader.js2
-rw-r--r--browser/components/asrouter/tests/browser/browser_asrouter_targeting.js2
-rw-r--r--browser/components/asrouter/tests/browser/browser_feature_callout_panel.js2
-rw-r--r--browser/components/asrouter/tests/browser/browser_trigger_listeners.js4
-rw-r--r--browser/components/asrouter/tests/browser/head.js4
-rw-r--r--browser/components/asrouter/tests/unit/ASRouterChild.test.js11
-rw-r--r--browser/components/asrouter/tests/unit/ASRouterTargeting.test.js4
-rw-r--r--browser/components/asrouter/tests/unit/CFRPageActions.test.js6
-rw-r--r--browser/components/asrouter/tests/unit/ModalOverlay.test.jsx69
-rw-r--r--browser/components/asrouter/tests/unit/TargetingDocs.test.js2
-rw-r--r--browser/components/asrouter/tests/unit/ToolbarPanelHub.test.js18
-rw-r--r--browser/components/asrouter/tests/unit/asrouter-utils.test.js36
-rw-r--r--browser/components/asrouter/tests/unit/unit-entry.js14
14 files changed, 71 insertions, 169 deletions
diff --git a/browser/components/asrouter/tests/browser/browser_asrouter_cfr.js b/browser/components/asrouter/tests/browser/browser_asrouter_cfr.js
index 0cab79994e..e29771c24f 100644
--- a/browser/components/asrouter/tests/browser/browser_asrouter_cfr.js
+++ b/browser/components/asrouter/tests/browser/browser_asrouter_cfr.js
@@ -183,7 +183,8 @@ add_setup(async function () {
// Store it in order to restore to the original value
const { _fetchLatestAddonVersion } = CFRPageActions;
// Prevent fetching the real addon url and making a network request
- CFRPageActions._fetchLatestAddonVersion = x => "http://example.com";
+ CFRPageActions._fetchLatestAddonVersion = () => "http://example.com";
+ Services.fog.testResetFOG();
registerCleanupFunction(() => {
CFRPageActions._fetchLatestAddonVersion = _fetchLatestAddonVersion;
@@ -193,20 +194,10 @@ add_setup(async function () {
});
add_task(async function test_cfr_notification_show() {
- registerCleanupFunction(() => {
- Services.prefs.clearUserPref(
- "browser.newtabpage.activity-stream.telemetry"
- );
- // Reset fog to clear pings here for private window test later.
- Services.fog.testResetFOG();
+ await SpecialPowers.pushPrefEnv({
+ set: [["browser.newtabpage.activity-stream.telemetry", true]],
});
- Services.prefs.setBoolPref(
- "browser.newtabpage.activity-stream.telemetry",
- true
- );
-
- Services.fog.testResetFOG();
let pingSubmitted = false;
GleanPings.messagingSystem.testBeforeNextSubmit(() => {
pingSubmitted = true;
@@ -266,6 +257,7 @@ add_task(async function test_cfr_notification_show() {
);
Assert.ok(pingSubmitted, "Recorded an event");
+ Services.fog.testResetFOG();
});
add_task(async function test_cfr_notification_show() {
@@ -332,6 +324,7 @@ add_task(async function test_cfr_notification_show() {
0,
"Should have removed the notification"
);
+ Services.fog.testResetFOG();
});
add_task(async function test_cfr_notification_minimize() {
@@ -379,6 +372,7 @@ add_task(async function test_cfr_notification_minimize() {
.getElementById("contextual-feature-recommendation-notification")
.button.click();
await hidePanel;
+ Services.fog.testResetFOG();
});
add_task(async function test_cfr_notification_minimize_2() {
@@ -441,6 +435,7 @@ add_task(async function test_cfr_notification_minimize_2() {
clearNotifications();
CFRPageActions.clearRecommendations();
+ Services.fog.testResetFOG();
});
add_task(async function test_cfr_addon_install() {
@@ -500,6 +495,7 @@ add_task(async function test_cfr_addon_install() {
);
clearNotifications();
+ Services.fog.testResetFOG();
});
add_task(
@@ -551,6 +547,7 @@ add_task(
await hidePanel;
await SpecialPowers.popPrefEnv();
clearNotifications();
+ Services.fog.testResetFOG();
}
);
@@ -642,6 +639,7 @@ add_task(async function test_cfr_addon_and_features_show() {
0,
"Should have removed the notification"
);
+ Services.fog.testResetFOG();
});
add_task(async function test_onLocationChange_cb() {
@@ -678,9 +676,8 @@ add_task(async function test_onLocationChange_cb() {
Assert.equal(count, 2, "We moved to a new document");
- registerCleanupFunction(() => {
- ASRouterTriggerListeners.get("openURL").uninit();
- });
+ ASRouterTriggerListeners.get("openURL").uninit();
+ Services.fog.testResetFOG();
});
add_task(async function test_matchPattern() {
@@ -730,9 +727,8 @@ add_task(async function test_matchPattern() {
"www.example.com is a different host that also matches the pattern."
);
- registerCleanupFunction(() => {
- ASRouterTriggerListeners.get("frequentVisits").uninit();
- });
+ ASRouterTriggerListeners.get("frequentVisits").uninit();
+ Services.fog.testResetFOG();
});
add_task(async function test_providerNames() {
@@ -741,11 +737,11 @@ add_task(async function test_providerNames() {
const cfrProviderPrefs = Services.prefs.getChildList(providersBranch);
for (const prefName of cfrProviderPrefs) {
const prefValue = JSON.parse(Services.prefs.getStringPref(prefName));
- if (prefValue && prefValue.id) {
+ if (prefValue?.id) {
Assert.equal(
prefValue.id,
prefName.slice(providersBranch.length),
- "Provider id and pref name do not match"
+ "Provider id and pref name should match"
);
}
}
@@ -804,6 +800,7 @@ add_task(async function test_cfr_notification_keyboard() {
.getElementById("contextual-feature-recommendation-notification")
.button.click();
await hidePanel;
+ Services.fog.testResetFOG();
});
add_task(function test_updateCycleForProviders() {
@@ -811,19 +808,18 @@ add_task(function test_updateCycleForProviders() {
.getChildList("browser.newtabpage.activity-stream.asrouter.providers.")
.forEach(provider => {
const prefValue = JSON.parse(Services.prefs.getStringPref(provider, ""));
- if (prefValue && prefValue.type === "remote-settings") {
- Assert.ok(prefValue.updateCycleInMs);
+ if (prefValue?.type === "remote-settings") {
+ is(
+ typeof prefValue.updateCycleInMs,
+ "number",
+ "updateCycleInMs is set"
+ );
}
});
});
add_task(async function test_heartbeat_tactic_2() {
clearNotifications();
- registerCleanupFunction(() => {
- // Remove the tab opened by clicking the heartbeat message
- gBrowser.removeCurrentTab();
- clearNotifications();
- });
const msg = (await CFRMessageProvider.getMessages()).find(
m => m.id === "HEARTBEAT_TACTIC_2"
@@ -858,18 +854,15 @@ add_task(async function test_heartbeat_tactic_2() {
document.getElementById("contextual-feature-recommendation").click();
await newTabPromise;
+ gBrowser.removeCurrentTab();
+ clearNotifications();
+ Services.fog.testResetFOG();
});
add_task(async function test_cfr_doorhanger_in_private_window() {
- registerCleanupFunction(() => {
- Services.prefs.clearUserPref(
- "browser.newtabpage.activity-stream.telemetry"
- );
+ await SpecialPowers.pushPrefEnv({
+ set: [["browser.newtabpage.activity-stream.telemetry", true]],
});
- Services.prefs.setBoolPref(
- "browser.newtabpage.activity-stream.telemetry",
- true
- );
let pingSubmitted = false;
GleanPings.messagingSystem.testBeforeNextSubmit(() => {
@@ -929,4 +922,5 @@ add_task(async function test_cfr_doorhanger_in_private_window() {
Assert.ok(pingSubmitted, "Submitted a CFR messaging system ping");
await BrowserTestUtils.closeWindow(win);
+ Services.fog.testResetFOG();
});
diff --git a/browser/components/asrouter/tests/browser/browser_asrouter_experimentsAPILoader.js b/browser/components/asrouter/tests/browser/browser_asrouter_experimentsAPILoader.js
index 14f4dda54f..88f284719e 100644
--- a/browser/components/asrouter/tests/browser/browser_asrouter_experimentsAPILoader.js
+++ b/browser/components/asrouter/tests/browser/browser_asrouter_experimentsAPILoader.js
@@ -444,7 +444,7 @@ add_task(async function test_emptyMessage() {
);
// Clear all messages
- ASRouter.setState(state => ({
+ ASRouter.setState(() => ({
messages: [],
}));
diff --git a/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js b/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js
index 432b4b75a7..55f278fd7d 100644
--- a/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js
+++ b/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js
@@ -93,7 +93,7 @@ add_task(async function return_nothing_for_no_matching_message() {
add_task(async function check_other_error_handling() {
let called = false;
- function onError(...args) {
+ function onError() {
called = true;
}
diff --git a/browser/components/asrouter/tests/browser/browser_feature_callout_panel.js b/browser/components/asrouter/tests/browser/browser_feature_callout_panel.js
index 1f87c71ec7..af2bc99e63 100644
--- a/browser/components/asrouter/tests/browser/browser_feature_callout_panel.js
+++ b/browser/components/asrouter/tests/browser/browser_feature_callout_panel.js
@@ -186,7 +186,7 @@ add_task(async function panel_feature_callout_anchor_open_attr() {
win.document.querySelector(calloutDismissSelector).click();
},
- (win, calloutContainer) => {
+ () => {
ok(
!anchor.hasAttribute("open"),
"Callout container's anchor node should not have its [open] attribute set"
diff --git a/browser/components/asrouter/tests/browser/browser_trigger_listeners.js b/browser/components/asrouter/tests/browser/browser_trigger_listeners.js
index 7c86645221..d7fb15b308 100644
--- a/browser/components/asrouter/tests/browser/browser_trigger_listeners.js
+++ b/browser/components/asrouter/tests/browser/browser_trigger_listeners.js
@@ -16,10 +16,10 @@ const mockIdleService = {
},
QueryInterface: ChromeUtils.generateQI(["nsIUserIdleService"]),
idleTime: 1200000,
- addIdleObserver(observer, time) {
+ addIdleObserver(observer) {
this._observers.add(observer);
},
- removeIdleObserver(observer, time) {
+ removeIdleObserver(observer) {
this._observers.delete(observer);
},
};
diff --git a/browser/components/asrouter/tests/browser/head.js b/browser/components/asrouter/tests/browser/head.js
index dd5e451540..51cd975d75 100644
--- a/browser/components/asrouter/tests/browser/head.js
+++ b/browser/components/asrouter/tests/browser/head.js
@@ -11,9 +11,7 @@ ChromeUtils.defineESModuleGetters(this, {
"resource:///modules/asrouter/FeatureCalloutMessages.sys.mjs",
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs",
-});
-XPCOMUtils.defineLazyModuleGetters(this, {
- QueryCache: "resource:///modules/asrouter/ASRouterTargeting.jsm",
+ QueryCache: "resource:///modules/asrouter/ASRouterTargeting.sys.mjs",
});
const { FxAccounts } = ChromeUtils.importESModule(
"resource://gre/modules/FxAccounts.sys.mjs"
diff --git a/browser/components/asrouter/tests/unit/ASRouterChild.test.js b/browser/components/asrouter/tests/unit/ASRouterChild.test.js
index 41fdd79ea2..b73e56d510 100644
--- a/browser/components/asrouter/tests/unit/ASRouterChild.test.js
+++ b/browser/components/asrouter/tests/unit/ASRouterChild.test.js
@@ -1,22 +1,12 @@
/*eslint max-nested-callbacks: ["error", 10]*/
import { ASRouterChild } from "actors/ASRouterChild.sys.mjs";
import { MESSAGE_TYPE_HASH as msg } from "modules/ActorConstants.sys.mjs";
-import { GlobalOverrider } from "test/unit/utils";
describe("ASRouterChild", () => {
let asRouterChild = null;
- let globals = null;
- let overrider = null;
let sandbox = null;
beforeEach(() => {
sandbox = sinon.createSandbox();
- globals = {
- Cu: {
- cloneInto: sandbox.stub().returns(Promise.resolve()),
- },
- };
- overrider = new GlobalOverrider();
- overrider.set(globals);
asRouterChild = new ASRouterChild();
asRouterChild.telemetry = {
sendTelemetry: sandbox.stub(),
@@ -26,7 +16,6 @@ describe("ASRouterChild", () => {
});
afterEach(() => {
sandbox.restore();
- overrider.restore();
asRouterChild = null;
});
describe("asRouterMessage", () => {
diff --git a/browser/components/asrouter/tests/unit/ASRouterTargeting.test.js b/browser/components/asrouter/tests/unit/ASRouterTargeting.test.js
index 610b488b47..392fa59aed 100644
--- a/browser/components/asrouter/tests/unit/ASRouterTargeting.test.js
+++ b/browser/components/asrouter/tests/unit/ASRouterTargeting.test.js
@@ -32,11 +32,11 @@ describe("#CachedTargetingGetter", () => {
globals.set(
"TargetingContext",
class {
- static combineContexts(...args) {
+ static combineContexts() {
return sinon.stub();
}
- evalWithDefault(expr) {
+ evalWithDefault() {
return sinon.stub();
}
}
diff --git a/browser/components/asrouter/tests/unit/CFRPageActions.test.js b/browser/components/asrouter/tests/unit/CFRPageActions.test.js
index 31970eb43a..92dfa43d92 100644
--- a/browser/components/asrouter/tests/unit/CFRPageActions.test.js
+++ b/browser/components/asrouter/tests/unit/CFRPageActions.test.js
@@ -554,7 +554,7 @@ describe("CFRPageActions", () => {
);
const htmlFooterEl = fakeRemoteL10n.createElement.args.find(
/* eslint-disable-next-line max-nested-callbacks */
- ([doc, el, args]) =>
+ ([, , args]) =>
args && args.content === fakeRecommendation.content.text
);
assert.ok(htmlFooterEl);
@@ -849,7 +849,7 @@ describe("CFRPageActions", () => {
);
const [, , headerElementArgs] = fakeRemoteL10n.createElement.args.find(
/* eslint-disable-next-line max-nested-callbacks */
- ([doc, el, args]) => args && args.content && args.attributes
+ ([, , args]) => args && args.content && args.attributes
);
assert.equal(
headerElementArgs.content.string_id,
@@ -872,7 +872,7 @@ describe("CFRPageActions", () => {
);
const [, , headerElementArgs] = fakeRemoteL10n.createElement.args.find(
/* eslint-disable-next-line max-nested-callbacks */
- ([doc, el, args]) => args && args.content && args.attributes
+ ([, , args]) => args && args.content && args.attributes
);
assert.equal(
headerElementArgs.content.string_id,
diff --git a/browser/components/asrouter/tests/unit/ModalOverlay.test.jsx b/browser/components/asrouter/tests/unit/ModalOverlay.test.jsx
deleted file mode 100644
index 2320e16fc3..0000000000
--- a/browser/components/asrouter/tests/unit/ModalOverlay.test.jsx
+++ /dev/null
@@ -1,69 +0,0 @@
-import { ModalOverlayWrapper } from "content-src/components/ModalOverlay/ModalOverlay";
-import { mount } from "enzyme";
-import React from "react";
-
-describe("ModalOverlayWrapper", () => {
- let fakeDoc;
- let sandbox;
- let header;
- beforeEach(() => {
- sandbox = sinon.createSandbox();
- header = document.createElement("div");
-
- fakeDoc = {
- addEventListener: sandbox.stub(),
- removeEventListener: sandbox.stub(),
- body: { classList: { add: sandbox.stub(), remove: sandbox.stub() } },
- getElementById() {
- return header;
- },
- };
- });
- afterEach(() => {
- sandbox.restore();
- });
- it("should add eventListener and a class on mount", async () => {
- mount(<ModalOverlayWrapper document={fakeDoc} />);
- assert.calledOnce(fakeDoc.addEventListener);
- assert.calledWith(fakeDoc.body.classList.add, "modal-open");
- });
-
- it("should remove eventListener on unmount", async () => {
- const wrapper = mount(<ModalOverlayWrapper document={fakeDoc} />);
- wrapper.unmount();
- assert.calledOnce(fakeDoc.addEventListener);
- assert.calledOnce(fakeDoc.removeEventListener);
- assert.calledWith(fakeDoc.body.classList.remove, "modal-open");
- });
-
- it("should call props.onClose on an Escape key", async () => {
- const onClose = sandbox.stub();
- mount(<ModalOverlayWrapper document={fakeDoc} onClose={onClose} />);
-
- // Simulate onkeydown being called
- const [, callback] = fakeDoc.addEventListener.firstCall.args;
- callback({ key: "Escape" });
-
- assert.calledOnce(onClose);
- });
-
- it("should not call props.onClose on other keys than Escape", async () => {
- const onClose = sandbox.stub();
- mount(<ModalOverlayWrapper document={fakeDoc} onClose={onClose} />);
-
- // Simulate onkeydown being called
- const [, callback] = fakeDoc.addEventListener.firstCall.args;
- callback({ key: "Ctrl" });
-
- assert.notCalled(onClose);
- });
-
- it("should not call props.onClose when clicked outside dialog", async () => {
- const onClose = sandbox.stub();
- const wrapper = mount(
- <ModalOverlayWrapper document={fakeDoc} onClose={onClose} />
- );
- wrapper.find("div.modalOverlayOuter.active").simulate("click");
- assert.notCalled(onClose);
- });
-});
diff --git a/browser/components/asrouter/tests/unit/TargetingDocs.test.js b/browser/components/asrouter/tests/unit/TargetingDocs.test.js
index d00f971453..536049e64b 100644
--- a/browser/components/asrouter/tests/unit/TargetingDocs.test.js
+++ b/browser/components/asrouter/tests/unit/TargetingDocs.test.js
@@ -50,7 +50,7 @@ describe("ASRTargeting docs", () => {
describe("All targeting params documented in targeting-attributes.md", () => {
for (const targetingParam of ASRTargetingAttributes) {
- // If this test is failing, you probably forgot to add docs to content-src/asrouter/targeting-attributes.md
+ // If this test is failing, you probably forgot to add docs to asrouter/docs/targeting-attributes.md
// for a new targeting attribute, or you forgot to put it in the table of contents up top.
it(`should have docs and table of contents entry for ${targetingParam}`, () => {
assert.include(
diff --git a/browser/components/asrouter/tests/unit/ToolbarPanelHub.test.js b/browser/components/asrouter/tests/unit/ToolbarPanelHub.test.js
index 64cb8243b7..1755f62308 100644
--- a/browser/components/asrouter/tests/unit/ToolbarPanelHub.test.js
+++ b/browser/components/asrouter/tests/unit/ToolbarPanelHub.test.js
@@ -392,14 +392,13 @@ describe("ToolbarPanelHub", () => {
for (let message of messages) {
assert.ok(
fakeRemoteL10n.createElement.args.find(
- ([doc, el, args]) =>
- args && args.classList === "whatsNew-message-title"
+ ([, , args]) => args && args.classList === "whatsNew-message-title"
)
);
if (message.content.layout === "tracking-protections") {
assert.ok(
fakeRemoteL10n.createElement.args.find(
- ([doc, el, args]) =>
+ ([, , args]) =>
args && args.classList === "whatsNew-message-subtitle"
)
);
@@ -407,13 +406,13 @@ describe("ToolbarPanelHub", () => {
if (message.id === "WHATS_NEW_FINGERPRINTER_COUNTER_72") {
assert.ok(
fakeRemoteL10n.createElement.args.find(
- ([doc, el, args]) => el === "h2" && args.content === 3
+ ([, el, args]) => el === "h2" && args.content === 3
)
);
}
assert.ok(
fakeRemoteL10n.createElement.args.find(
- ([doc, el, args]) =>
+ ([, , args]) =>
args && args.classList === "whatsNew-message-content"
)
);
@@ -456,10 +455,9 @@ describe("ToolbarPanelHub", () => {
// value as the `order` field of the message
const titleEls = fakeRemoteL10n.createElement.args
.filter(
- ([doc, el, args]) =>
- args && args.classList === "whatsNew-message-title"
+ ([, , args]) => args && args.classList === "whatsNew-message-title"
)
- .map(([doc, el, args]) => args.content);
+ .map(([, , args]) => args.content);
assert.deepEqual(titleEls, [1, 2, 3]);
});
it("should accept string for image attributes", async () => {
@@ -488,7 +486,7 @@ describe("ToolbarPanelHub", () => {
await instance.renderMessages(fakeWindow, fakeDocument, "container-id");
const [, , args] = fakeRemoteL10n.createElement.args.find(
- ([doc, el, elArgs]) => elArgs && elArgs.attributes
+ ([, , elArgs]) => elArgs && elArgs.attributes
);
assert.ok(args);
// Currently this.state.contentArguments has 8 different entries
@@ -510,7 +508,7 @@ describe("ToolbarPanelHub", () => {
await instance.renderMessages(fakeWindow, fakeDocument, "container-id");
const dateElements = fakeRemoteL10n.createElement.args.filter(
- ([doc, el, args]) =>
+ ([, el, args]) =>
el === "p" && args.classList === "whatsNew-message-date"
);
assert.lengthOf(dateElements, uniqueDates.length);
diff --git a/browser/components/asrouter/tests/unit/asrouter-utils.test.js b/browser/components/asrouter/tests/unit/asrouter-utils.test.js
index 553c9608ed..81252b4d50 100644
--- a/browser/components/asrouter/tests/unit/asrouter-utils.test.js
+++ b/browser/components/asrouter/tests/unit/asrouter-utils.test.js
@@ -1,30 +1,22 @@
-import { ASRouterUtils } from "content-src/asrouter-utils";
-import { GlobalOverrider } from "test/unit/utils";
+import { ASRouterUtils } from "../../content-src/asrouter-utils.mjs";
describe("ASRouterUtils", () => {
- let globals = null;
- let overrider = null;
let sandbox = null;
beforeEach(() => {
sandbox = sinon.createSandbox();
- globals = {
- ASRouterMessage: sandbox.stub().resolves({}),
- };
- overrider = new GlobalOverrider();
- overrider.set(globals);
+ globalThis.ASRouterMessage = sandbox.stub().resolves({});
});
afterEach(() => {
sandbox.restore();
- overrider.restore();
});
describe("sendMessage", () => {
it("default", () => {
ASRouterUtils.sendMessage({ foo: "bar" });
- assert.calledOnce(globals.ASRouterMessage);
- assert.calledWith(globals.ASRouterMessage, { foo: "bar" });
+ assert.calledOnce(globalThis.ASRouterMessage);
+ assert.calledWith(globalThis.ASRouterMessage, { foo: "bar" });
});
it("throws if ASRouterMessage is not defined", () => {
- overrider.set("ASRouterMessage", undefined);
+ globalThis.ASRouterMessage = null;
assert.throws(() => ASRouterUtils.sendMessage({ foo: "bar" }));
});
it("can accept the legacy NEWTAB_MESSAGE_REQUEST message without throwing", async () => {
@@ -41,7 +33,7 @@ describe("ASRouterUtils", () => {
it("default", () => {
ASRouterUtils.blockById(1, { foo: "bar" });
assert.calledWith(
- globals.ASRouterMessage,
+ globalThis.ASRouterMessage,
sinon.match({ data: { foo: "bar", id: 1 } })
);
});
@@ -50,7 +42,7 @@ describe("ASRouterUtils", () => {
it("default", () => {
ASRouterUtils.modifyMessageJson({ foo: "bar" });
assert.calledWith(
- globals.ASRouterMessage,
+ globalThis.ASRouterMessage,
sinon.match({ data: { content: { foo: "bar" } } })
);
});
@@ -59,7 +51,7 @@ describe("ASRouterUtils", () => {
it("default", () => {
ASRouterUtils.executeAction({ foo: "bar" });
assert.calledWith(
- globals.ASRouterMessage,
+ globalThis.ASRouterMessage,
sinon.match({ data: { foo: "bar" } })
);
});
@@ -68,7 +60,7 @@ describe("ASRouterUtils", () => {
it("default", () => {
ASRouterUtils.unblockById(2);
assert.calledWith(
- globals.ASRouterMessage,
+ globalThis.ASRouterMessage,
sinon.match({ data: { id: 2 } })
);
});
@@ -77,7 +69,7 @@ describe("ASRouterUtils", () => {
it("default", () => {
ASRouterUtils.blockBundle(2);
assert.calledWith(
- globals.ASRouterMessage,
+ globalThis.ASRouterMessage,
sinon.match({ data: { bundle: 2 } })
);
});
@@ -86,7 +78,7 @@ describe("ASRouterUtils", () => {
it("default", () => {
ASRouterUtils.unblockBundle(2);
assert.calledWith(
- globals.ASRouterMessage,
+ globalThis.ASRouterMessage,
sinon.match({ data: { bundle: 2 } })
);
});
@@ -95,7 +87,7 @@ describe("ASRouterUtils", () => {
it("default", () => {
ASRouterUtils.overrideMessage(12);
assert.calledWith(
- globals.ASRouterMessage,
+ globalThis.ASRouterMessage,
sinon.match({ data: { id: 12 } })
);
});
@@ -104,7 +96,7 @@ describe("ASRouterUtils", () => {
it("default", () => {
ASRouterUtils.editState("foo", "bar");
assert.calledWith(
- globals.ASRouterMessage,
+ globalThis.ASRouterMessage,
sinon.match({ data: { foo: "bar" } })
);
});
@@ -112,7 +104,7 @@ describe("ASRouterUtils", () => {
describe("sendTelemetry", () => {
it("default", () => {
ASRouterUtils.sendTelemetry({ foo: "bar" });
- assert.calledOnce(globals.ASRouterMessage);
+ assert.calledOnce(globalThis.ASRouterMessage);
});
});
});
diff --git a/browser/components/asrouter/tests/unit/unit-entry.js b/browser/components/asrouter/tests/unit/unit-entry.js
index b8b799e051..f2046a81cb 100644
--- a/browser/components/asrouter/tests/unit/unit-entry.js
+++ b/browser/components/asrouter/tests/unit/unit-entry.js
@@ -105,8 +105,8 @@ const TEST_GLOBAL = {
JSWindowActorParent,
JSWindowActorChild,
AboutReaderParent: {
- addMessageListener: (messageName, listener) => {},
- removeMessageListener: (messageName, listener) => {},
+ addMessageListener: (_messageName, _listener) => {},
+ removeMessageListener: (_messageName, _listener) => {},
},
AboutWelcomeTelemetry: class {
submitGleanPingForPing() {}
@@ -289,8 +289,8 @@ const TEST_GLOBAL = {
},
dump() {},
EveryWindow: {
- registerCallback: (id, init, uninit) => {},
- unregisterCallback: id => {},
+ registerCallback: (_id, _init, _uninit) => {},
+ unregisterCallback: _id => {},
},
setTimeout: window.setTimeout.bind(window),
clearTimeout: window.clearTimeout.bind(window),
@@ -410,7 +410,7 @@ const TEST_GLOBAL = {
},
urlFormatter: { formatURL: str => str, formatURLPref: str => str },
mm: {
- addMessageListener: (msg, cb) => this.receiveMessage(),
+ addMessageListener: (_msg, _cb) => this.receiveMessage(),
removeMessageListener() {},
},
obs: {
@@ -420,7 +420,7 @@ const TEST_GLOBAL = {
},
telemetry: {
setEventRecordingEnabled: () => {},
- recordEvent: eventDetails => {},
+ recordEvent: _eventDetails => {},
scalarSet: () => {},
keyedScalarAdd: () => {},
},
@@ -578,7 +578,7 @@ const TEST_GLOBAL = {
finish: () => {},
},
Sampling: {
- ratioSample(seed, ratios) {
+ ratioSample(_seed, _ratios) {
return Promise.resolve(0);
},
},