diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /browser/components/asrouter/tests/unit | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/asrouter/tests/unit')
8 files changed, 47 insertions, 1064 deletions
diff --git a/browser/components/asrouter/tests/unit/ASRouter.test.js b/browser/components/asrouter/tests/unit/ASRouter.test.js index 7df1449a14..1f5899fce1 100644 --- a/browser/components/asrouter/tests/unit/ASRouter.test.js +++ b/browser/components/asrouter/tests/unit/ASRouter.test.js @@ -48,7 +48,6 @@ describe("ASRouter", () => { let fakeAttributionCode; let fakeTargetingContext; let FakeToolbarBadgeHub; - let FakeToolbarPanelHub; let FakeMomentsPageHub; let ASRouterTargeting; let screenImpressions; @@ -151,7 +150,6 @@ describe("ASRouter", () => { cfr: "", "message-groups": "", "messaging-experiments": "", - "whats-new-panel": "", }, totalBookmarksCount: {}, firefoxVersion: 80, @@ -159,7 +157,6 @@ describe("ASRouter", () => { needsUpdate: {}, hasPinnedTabs: false, hasAccessedFxAPanel: false, - isWhatsNewPanelEnabled: true, userPrefs: { cfrFeatures: true, cfrAddons: true, @@ -203,12 +200,6 @@ describe("ASRouter", () => { writeAttributionFile: () => Promise.resolve(), getCachedAttributionData: sinon.stub(), }; - FakeToolbarPanelHub = { - init: sandbox.stub(), - uninit: sandbox.stub(), - forceShowMessage: sandbox.stub(), - enableToolbarButton: sandbox.stub(), - }; FakeToolbarBadgeHub = { init: sandbox.stub(), uninit: sandbox.stub(), @@ -252,7 +243,6 @@ describe("ASRouter", () => { PanelTestProvider, MacAttribution: { applicationPath: "" }, ToolbarBadgeHub: FakeToolbarBadgeHub, - ToolbarPanelHub: FakeToolbarPanelHub, MomentsPageHub: FakeMomentsPageHub, KintoHttpClient: class { bucket() { @@ -354,7 +344,6 @@ describe("ASRouter", () => { // ASRouter init called in `beforeEach` block above assert.calledOnce(FakeToolbarBadgeHub.init); - assert.calledOnce(FakeToolbarPanelHub.init); assert.calledOnce(FakeMomentsPageHub.init); assert.calledWithExactly( @@ -370,15 +359,6 @@ describe("ASRouter", () => { ); assert.calledWithExactly( - FakeToolbarPanelHub.init, - Router.waitForInitialized, - { - getMessages: Router.handleMessageRequest, - sendTelemetry: Router.sendTelemetry, - } - ); - - assert.calledWithExactly( FakeMomentsPageHub.init, Router.waitForInitialized, { @@ -678,25 +658,10 @@ describe("ASRouter", () => { sandbox.stub(CFRPageActions, "addRecommendation"); browser = {}; }); - it("should route whatsnew_panel_message message to the right hub", () => { - Router.routeCFRMessage( - { template: "whatsnew_panel_message" }, - browser, - "", - true - ); - - assert.calledOnce(FakeToolbarPanelHub.forceShowMessage); - assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); - assert.notCalled(CFRPageActions.addRecommendation); - assert.notCalled(CFRPageActions.forceRecommendation); - assert.notCalled(FakeMomentsPageHub.executeAction); - }); it("should route moments messages to the right hub", () => { Router.routeCFRMessage({ template: "update_action" }, browser, "", true); assert.calledOnce(FakeMomentsPageHub.executeAction); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); assert.notCalled(CFRPageActions.addRecommendation); assert.notCalled(CFRPageActions.forceRecommendation); @@ -705,7 +670,6 @@ describe("ASRouter", () => { Router.routeCFRMessage({ template: "toolbar_badge" }, browser); assert.calledOnce(FakeToolbarBadgeHub.registerBadgeNotificationListener); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(CFRPageActions.addRecommendation); assert.notCalled(CFRPageActions.forceRecommendation); assert.notCalled(FakeMomentsPageHub.executeAction); @@ -721,7 +685,6 @@ describe("ASRouter", () => { assert.calledOnce(CFRPageActions.addRecommendation); assert.notCalled(CFRPageActions.forceRecommendation); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(FakeMomentsPageHub.executeAction); }); it("should route cfr_doorhanger message to the right hub force = false", () => { @@ -733,7 +696,6 @@ describe("ASRouter", () => { ); assert.calledOnce(CFRPageActions.addRecommendation); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); assert.notCalled(CFRPageActions.forceRecommendation); assert.notCalled(FakeMomentsPageHub.executeAction); @@ -742,7 +704,6 @@ describe("ASRouter", () => { Router.routeCFRMessage({ template: "cfr_doorhanger" }, browser, {}, true); assert.calledOnce(CFRPageActions.forceRecommendation); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(CFRPageActions.addRecommendation); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); assert.notCalled(FakeMomentsPageHub.executeAction); @@ -759,7 +720,6 @@ describe("ASRouter", () => { const { args } = CFRPageActions.addRecommendation.firstCall; // Host should be null assert.isNull(args[1]); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); assert.notCalled(CFRPageActions.forceRecommendation); assert.notCalled(FakeMomentsPageHub.executeAction); @@ -773,7 +733,6 @@ describe("ASRouter", () => { ); assert.calledOnce(CFRPageActions.forceRecommendation); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(CFRPageActions.addRecommendation); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); assert.notCalled(FakeMomentsPageHub.executeAction); @@ -786,7 +745,6 @@ describe("ASRouter", () => { true ); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(CFRPageActions.forceRecommendation); assert.notCalled(CFRPageActions.addRecommendation); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); @@ -961,7 +919,6 @@ describe("ASRouter", () => { type: "local", enabled: true, messages: [ - "whatsnew_panel_message", "cfr_doorhanger", "toolbar_badge", "update_action", @@ -1272,43 +1229,6 @@ describe("ASRouter", () => { Router.state.messageImpressions ); }); - it("should return all unblocked messages that match the template, trigger if returnAll=true", async () => { - const message1 = { - provider: "whats_new", - id: "1", - template: "whatsnew_panel_message", - trigger: { id: "whatsNewPanelOpened" }, - groups: ["whats_new"], - }; - const message2 = { - provider: "whats_new", - id: "2", - template: "whatsnew_panel_message", - trigger: { id: "whatsNewPanelOpened" }, - groups: ["whats_new"], - }; - const message3 = { - provider: "whats_new", - id: "3", - template: "badge", - groups: ["whats_new"], - }; - ASRouterTargeting.findMatchingMessage.callsFake(() => [ - message2, - message1, - ]); - await Router.setState({ - messages: [message3, message2, message1], - providers: [{ id: "whats_new" }], - }); - const result = await Router.handleMessageRequest({ - template: "whatsnew_panel_message", - triggerId: "whatsNewPanelOpened", - returnAll: true, - }); - - assert.deepEqual(result, [message2, message1]); - }); it("should forward trigger param info", async () => { const trigger = { triggerId: "foo", @@ -1854,33 +1774,6 @@ describe("ASRouter", () => { }); }); - describe("#forceWNPanel", () => { - let browser = { - ownerGlobal: { - document: new Document(), - PanelUI: { - showSubView: sinon.stub(), - panel: { - setAttribute: sinon.stub(), - }, - }, - }, - }; - let fakePanel = { - setAttribute: sinon.stub(), - }; - sinon - .stub(browser.ownerGlobal.document, "getElementById") - .returns(fakePanel); - - it("should call enableToolbarButton", async () => { - await Router.forceWNPanel(browser); - assert.calledOnce(FakeToolbarPanelHub.enableToolbarButton); - assert.calledOnce(browser.ownerGlobal.PanelUI.showSubView); - assert.calledWith(fakePanel.setAttribute, "noautohide", true); - }); - }); - describe("_triggerHandler", () => { it("should call #sendTriggerMessage with the correct trigger", () => { const getter = sandbox.stub(); diff --git a/browser/components/asrouter/tests/unit/ASRouterChild.test.js b/browser/components/asrouter/tests/unit/ASRouterChild.test.js index b73e56d510..c6533e073d 100644 --- a/browser/components/asrouter/tests/unit/ASRouterChild.test.js +++ b/browser/components/asrouter/tests/unit/ASRouterChild.test.js @@ -1,6 +1,6 @@ /*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 { MESSAGE_TYPE_HASH as msg } from "modules/ActorConstants.mjs"; describe("ASRouterChild", () => { let asRouterChild = null; @@ -24,7 +24,6 @@ describe("ASRouterChild", () => { msg.DISABLE_PROVIDER, msg.ENABLE_PROVIDER, msg.EXPIRE_QUERY_CACHE, - msg.FORCE_WHATSNEW_PANEL, msg.IMPRESSION, msg.RESET_PROVIDER_PREF, msg.SET_PROVIDER_USER_PREF, diff --git a/browser/components/asrouter/tests/unit/ASRouterParent.test.js b/browser/components/asrouter/tests/unit/ASRouterParent.test.js index 0358b1261c..e65d7db825 100644 --- a/browser/components/asrouter/tests/unit/ASRouterParent.test.js +++ b/browser/components/asrouter/tests/unit/ASRouterParent.test.js @@ -1,5 +1,5 @@ import { ASRouterParent } from "actors/ASRouterParent.sys.mjs"; -import { MESSAGE_TYPE_HASH as msg } from "modules/ActorConstants.sys.mjs"; +import { MESSAGE_TYPE_HASH as msg } from "modules/ActorConstants.mjs"; describe("ASRouterParent", () => { let asRouterParent = null; diff --git a/browser/components/asrouter/tests/unit/ASRouterParentProcessMessageHandler.test.js b/browser/components/asrouter/tests/unit/ASRouterParentProcessMessageHandler.test.js index 7bfec3e099..6a965c5689 100644 --- a/browser/components/asrouter/tests/unit/ASRouterParentProcessMessageHandler.test.js +++ b/browser/components/asrouter/tests/unit/ASRouterParentProcessMessageHandler.test.js @@ -1,6 +1,6 @@ import { ASRouterParentProcessMessageHandler } from "modules/ASRouterParentProcessMessageHandler.sys.mjs"; import { _ASRouter } from "modules/ASRouter.sys.mjs"; -import { MESSAGE_TYPE_HASH as msg } from "modules/ActorConstants.sys.mjs"; +import { MESSAGE_TYPE_HASH as msg } from "modules/ActorConstants.mjs"; describe("ASRouterParentProcessMessageHandler", () => { let handler = null; @@ -14,8 +14,6 @@ describe("ASRouterParentProcessMessageHandler", () => { "addImpression", "evaluateExpression", "forceAttribution", - "forceWNPanel", - "closeWNPanel", "forcePBWindow", "resetGroupsState", "resetMessageState", @@ -122,7 +120,6 @@ describe("ASRouterParentProcessMessageHandler", () => { [ msg.AS_ROUTER_TELEMETRY_USER_EVENT, msg.TOOLBAR_BADGE_TELEMETRY, - msg.TOOLBAR_PANEL_TELEMETRY, msg.MOMENTS_PAGE_TELEMETRY, msg.DOORHANGER_TELEMETRY, ].forEach(type => { @@ -309,28 +306,6 @@ describe("ASRouterParentProcessMessageHandler", () => { assert.calledOnce(config.router.forceAttribution); }); }); - describe("FORCE_WHATSNEW_PANEL action", () => { - it("default calls forceWNPanel", () => { - handler.handleMessage( - msg.FORCE_WHATSNEW_PANEL, - {}, - { browser: { ownerGlobal: {} } } - ); - assert.calledOnce(config.router.forceWNPanel); - assert.calledWith(config.router.forceWNPanel, { ownerGlobal: {} }); - }); - }); - describe("CLOSE_WHATSNEW_PANEL action", () => { - it("default calls closeWNPanel", () => { - handler.handleMessage( - msg.CLOSE_WHATSNEW_PANEL, - {}, - { browser: { ownerGlobal: {} } } - ); - assert.calledOnce(config.router.closeWNPanel); - assert.calledWith(config.router.closeWNPanel, { ownerGlobal: {} }); - }); - }); describe("FORCE_PRIVATE_BROWSING_WINDOW action", () => { it("default calls forcePBWindow", () => { handler.handleMessage( diff --git a/browser/components/asrouter/tests/unit/ToolbarBadgeHub.test.js b/browser/components/asrouter/tests/unit/ToolbarBadgeHub.test.js index 3e91b657bc..cfeac77025 100644 --- a/browser/components/asrouter/tests/unit/ToolbarBadgeHub.test.js +++ b/browser/components/asrouter/tests/unit/ToolbarBadgeHub.test.js @@ -1,10 +1,6 @@ import { _ToolbarBadgeHub } from "modules/ToolbarBadgeHub.sys.mjs"; import { GlobalOverrider } from "test/unit/utils"; import { OnboardingMessageProvider } from "modules/OnboardingMessageProvider.sys.mjs"; -import { - _ToolbarPanelHub, - ToolbarPanelHub, -} from "modules/ToolbarPanelHub.sys.mjs"; describe("ToolbarBadgeHub", () => { let sandbox; @@ -13,7 +9,6 @@ describe("ToolbarBadgeHub", () => { let fakeSendTelemetry; let isBrowserPrivateStub; let fxaMessage; - let whatsnewMessage; let fakeElement; let globals; let everyWindowStub; @@ -36,28 +31,6 @@ describe("ToolbarBadgeHub", () => { const onboardingMsgs = await OnboardingMessageProvider.getUntranslatedMessages(); fxaMessage = onboardingMsgs.find(({ id }) => id === "FXA_ACCOUNTS_BADGE"); - whatsnewMessage = { - id: `WHATS_NEW_BADGE_71`, - template: "toolbar_badge", - content: { - delay: 1000, - target: "whats-new-menu-button", - action: { id: "show-whatsnew-button" }, - badgeDescription: { string_id: "cfr-badge-reader-label-newfeature" }, - }, - priority: 1, - trigger: { id: "toolbarBadgeUpdate" }, - frequency: { - // Makes it so that we track impressions for this message while at the - // same time it can have unlimited impressions - lifetime: Infinity, - }, - // Never saw this message or saw it in the past 4 days or more recent - targeting: `isWhatsNewPanelEnabled && - (!messageImpressions['WHATS_NEW_BADGE_71'] || - (messageImpressions['WHATS_NEW_BADGE_71']|length >= 1 && - currentDate|date - messageImpressions['WHATS_NEW_BADGE_71'][0] <= 4 * 24 * 3600 * 1000))`, - }; fakeElement = { classList: { add: sandbox.stub(), @@ -93,7 +66,6 @@ describe("ToolbarBadgeHub", () => { setStringPrefStub = sandbox.stub(); requestIdleCallbackStub = sandbox.stub().callsFake(fn => fn()); globals.set({ - ToolbarPanelHub, requestIdleCallback: requestIdleCallbackStub, EveryWindow: everyWindowStub, PrivateBrowsingUtils: { isBrowserPrivate: isBrowserPrivateStub }, @@ -139,16 +111,6 @@ describe("ToolbarBadgeHub", () => { assert.calledTwice(instance.messageRequest); }); - it("should add a pref observer", async () => { - await instance.init(sandbox.stub().resolves(), {}); - - assert.calledOnce(addObserverStub); - assert.calledWithExactly( - addObserverStub, - instance.prefs.WHATSNEW_TOOLBAR_PANEL, - instance - ); - }); }); describe("#uninit", () => { beforeEach(async () => { @@ -164,16 +126,6 @@ describe("ToolbarBadgeHub", () => { assert.calledOnce(clearTimeoutStub); assert.calledWithExactly(clearTimeoutStub, 2); }); - it("should remove the pref observer", () => { - instance.uninit(); - - assert.calledOnce(removeObserverStub); - assert.calledWithExactly( - removeObserverStub, - instance.prefs.WHATSNEW_TOOLBAR_PANEL, - instance - ); - }); }); describe("messageRequest", () => { let handleMessageRequestStub; @@ -293,66 +245,6 @@ describe("ToolbarBadgeHub", () => { instance.removeAllNotifications ); }); - it("should execute actions if they exist", () => { - sandbox.stub(instance, "executeAction"); - instance.addToolbarNotification(target, whatsnewMessage); - - assert.calledOnce(instance.executeAction); - assert.calledWithExactly(instance.executeAction, { - ...whatsnewMessage.content.action, - message_id: whatsnewMessage.id, - }); - }); - it("should create a description element", () => { - sandbox.stub(instance, "executeAction"); - instance.addToolbarNotification(target, whatsnewMessage); - - assert.calledOnce(fakeDocument.createElement); - assert.calledWithExactly(fakeDocument.createElement, "span"); - }); - it("should set description id to element and to button", () => { - sandbox.stub(instance, "executeAction"); - instance.addToolbarNotification(target, whatsnewMessage); - - assert.calledWithExactly( - fakeElement.setAttribute, - "id", - "toolbarbutton-notification-description" - ); - assert.calledWithExactly( - fakeElement.setAttribute, - "aria-labelledby", - `toolbarbutton-notification-description ${whatsnewMessage.content.target}` - ); - }); - it("should attach fluent id to description", () => { - sandbox.stub(instance, "executeAction"); - instance.addToolbarNotification(target, whatsnewMessage); - - assert.calledOnce(fakeDocument.l10n.setAttributes); - assert.calledWithExactly( - fakeDocument.l10n.setAttributes, - fakeElement, - whatsnewMessage.content.badgeDescription.string_id - ); - }); - it("should add an impression for the message", () => { - instance.addToolbarNotification(target, whatsnewMessage); - - assert.calledOnce(instance._addImpression); - assert.calledWithExactly(instance._addImpression, whatsnewMessage); - }); - it("should send an impression ping", async () => { - sandbox.stub(instance, "sendUserEventTelemetry"); - instance.addToolbarNotification(target, whatsnewMessage); - - assert.calledOnce(instance.sendUserEventTelemetry); - assert.calledWithExactly( - instance.sendUserEventTelemetry, - "IMPRESSION", - whatsnewMessage - ); - }); }); describe("registerBadgeNotificationListener", () => { let msg_no_delay; @@ -410,44 +302,6 @@ describe("ToolbarBadgeHub", () => { assert.calledOnce(everyWindowStub.unregisterCallback); assert.calledWithExactly(everyWindowStub.unregisterCallback, instance.id); }); - it("should only call executeAction for 'update_action' messages", () => { - const stub = sandbox.stub(instance, "executeAction"); - const updateActionMsg = { ...msg_no_delay, template: "update_action" }; - - instance.registerBadgeNotificationListener(updateActionMsg); - - assert.notCalled(everyWindowStub.registerCallback); - assert.calledOnce(stub); - }); - }); - describe("executeAction", () => { - let blockMessageByIdStub; - beforeEach(async () => { - blockMessageByIdStub = sandbox.stub(); - await instance.init(sandbox.stub().resolves(), { - blockMessageById: blockMessageByIdStub, - }); - }); - it("should call ToolbarPanelHub.enableToolbarButton", () => { - const stub = sandbox.stub( - _ToolbarPanelHub.prototype, - "enableToolbarButton" - ); - - instance.executeAction({ id: "show-whatsnew-button" }); - - assert.calledOnce(stub); - }); - it("should call ToolbarPanelHub.enableAppmenuButton", () => { - const stub = sandbox.stub( - _ToolbarPanelHub.prototype, - "enableAppmenuButton" - ); - - instance.executeAction({ id: "show-whatsnew-button" }); - - assert.calledOnce(stub); - }); }); describe("removeToolbarNotification", () => { it("should remove the notification", () => { @@ -629,24 +483,4 @@ describe("ToolbarBadgeHub", () => { assert.propertyVal(ping.data, "event", "CLICK"); }); }); - describe("#observe", () => { - it("should make a message request when the whats new pref is changed", () => { - sandbox.stub(instance, "messageRequest"); - - instance.observe("", "", instance.prefs.WHATSNEW_TOOLBAR_PANEL); - - assert.calledOnce(instance.messageRequest); - assert.calledWithExactly(instance.messageRequest, { - template: "toolbar_badge", - triggerId: "toolbarBadgeUpdate", - }); - }); - it("should not react to other pref changes", () => { - sandbox.stub(instance, "messageRequest"); - - instance.observe("", "", "foo"); - - assert.notCalled(instance.messageRequest); - }); - }); }); diff --git a/browser/components/asrouter/tests/unit/ToolbarPanelHub.test.js b/browser/components/asrouter/tests/unit/ToolbarPanelHub.test.js deleted file mode 100644 index 1755f62308..0000000000 --- a/browser/components/asrouter/tests/unit/ToolbarPanelHub.test.js +++ /dev/null @@ -1,760 +0,0 @@ -import { _ToolbarPanelHub } from "modules/ToolbarPanelHub.sys.mjs"; -import { GlobalOverrider } from "test/unit/utils"; -import { PanelTestProvider } from "modules/PanelTestProvider.sys.mjs"; - -describe("ToolbarPanelHub", () => { - let globals; - let sandbox; - let instance; - let everyWindowStub; - let fakeDocument; - let fakeWindow; - let fakeElementById; - let fakeElementByTagName; - let createdCustomElements = []; - let eventListeners = {}; - let addObserverStub; - let removeObserverStub; - let getBoolPrefStub; - let setBoolPrefStub; - let waitForInitializedStub; - let isBrowserPrivateStub; - let fakeSendTelemetry; - let getEarliestRecordedDateStub; - let getEventsByDateRangeStub; - let defaultSearchStub; - let scriptloaderStub; - let fakeRemoteL10n; - let getViewNodeStub; - - beforeEach(async () => { - sandbox = sinon.createSandbox(); - globals = new GlobalOverrider(); - instance = new _ToolbarPanelHub(); - waitForInitializedStub = sandbox.stub().resolves(); - fakeElementById = { - setAttribute: sandbox.stub(), - removeAttribute: sandbox.stub(), - querySelector: sandbox.stub().returns(null), - querySelectorAll: sandbox.stub().returns([]), - appendChild: sandbox.stub(), - addEventListener: sandbox.stub(), - hasAttribute: sandbox.stub(), - toggleAttribute: sandbox.stub(), - remove: sandbox.stub(), - removeChild: sandbox.stub(), - }; - fakeElementByTagName = { - setAttribute: sandbox.stub(), - removeAttribute: sandbox.stub(), - querySelector: sandbox.stub().returns(null), - querySelectorAll: sandbox.stub().returns([]), - appendChild: sandbox.stub(), - addEventListener: sandbox.stub(), - hasAttribute: sandbox.stub(), - toggleAttribute: sandbox.stub(), - remove: sandbox.stub(), - removeChild: sandbox.stub(), - }; - fakeDocument = { - getElementById: sandbox.stub().returns(fakeElementById), - getElementsByTagName: sandbox.stub().returns(fakeElementByTagName), - querySelector: sandbox.stub().returns({}), - createElement: tagName => { - const element = { - tagName, - classList: {}, - addEventListener: (ev, fn) => { - eventListeners[ev] = fn; - }, - appendChild: sandbox.stub(), - setAttribute: sandbox.stub(), - textContent: "", - }; - element.classList.add = sandbox.stub(); - element.classList.includes = className => - element.classList.add.firstCall.args[0] === className; - createdCustomElements.push(element); - return element; - }, - l10n: { - translateElements: sandbox.stub(), - translateFragment: sandbox.stub(), - formatMessages: sandbox.stub().resolves([{}]), - setAttributes: sandbox.stub(), - }, - }; - fakeWindow = { - // eslint-disable-next-line object-shorthand - DocumentFragment: function () { - return fakeElementById; - }, - document: fakeDocument, - browser: { - ownerDocument: fakeDocument, - }, - MozXULElement: { insertFTLIfNeeded: sandbox.stub() }, - ownerGlobal: { - openLinkIn: sandbox.stub(), - gBrowser: "gBrowser", - }, - PanelUI: { - panel: fakeElementById, - whatsNewPanel: fakeElementById, - }, - customElements: { get: sandbox.stub() }, - }; - everyWindowStub = { - registerCallback: sandbox.stub(), - unregisterCallback: sandbox.stub(), - }; - scriptloaderStub = { loadSubScript: sandbox.stub() }; - addObserverStub = sandbox.stub(); - removeObserverStub = sandbox.stub(); - getBoolPrefStub = sandbox.stub(); - setBoolPrefStub = sandbox.stub(); - fakeSendTelemetry = sandbox.stub(); - isBrowserPrivateStub = sandbox.stub(); - getEarliestRecordedDateStub = sandbox.stub().returns( - // A random date that's not the current timestamp - new Date() - 500 - ); - getEventsByDateRangeStub = sandbox.stub().returns([]); - getViewNodeStub = sandbox.stub().returns(fakeElementById); - defaultSearchStub = { defaultEngine: { name: "DDG" } }; - fakeRemoteL10n = { - l10n: {}, - reloadL10n: sandbox.stub(), - createElement: sandbox - .stub() - .callsFake((doc, el) => fakeDocument.createElement(el)), - }; - globals.set({ - EveryWindow: everyWindowStub, - Services: { - ...Services, - prefs: { - addObserver: addObserverStub, - removeObserver: removeObserverStub, - getBoolPref: getBoolPrefStub, - setBoolPref: setBoolPrefStub, - }, - search: defaultSearchStub, - scriptloader: scriptloaderStub, - }, - PrivateBrowsingUtils: { - isBrowserPrivate: isBrowserPrivateStub, - }, - TrackingDBService: { - getEarliestRecordedDate: getEarliestRecordedDateStub, - getEventsByDateRange: getEventsByDateRangeStub, - }, - SpecialMessageActions: { - handleAction: sandbox.stub(), - }, - RemoteL10n: fakeRemoteL10n, - PanelMultiView: { - getViewNode: getViewNodeStub, - }, - }); - }); - afterEach(() => { - instance.uninit(); - sandbox.restore(); - globals.restore(); - eventListeners = {}; - createdCustomElements = []; - }); - it("should create an instance", () => { - assert.ok(instance); - }); - it("should enableAppmenuButton() on init() just once", async () => { - instance.enableAppmenuButton = sandbox.stub(); - - await instance.init(waitForInitializedStub, { getMessages: () => {} }); - await instance.init(waitForInitializedStub, { getMessages: () => {} }); - - assert.calledOnce(instance.enableAppmenuButton); - - instance.uninit(); - - await instance.init(waitForInitializedStub, { getMessages: () => {} }); - - assert.calledTwice(instance.enableAppmenuButton); - }); - it("should unregisterCallback on uninit()", () => { - instance.uninit(); - assert.calledTwice(everyWindowStub.unregisterCallback); - }); - describe("#maybeLoadCustomElement", () => { - it("should not load customElements a second time", () => { - instance.maybeLoadCustomElement({ customElements: new Map() }); - instance.maybeLoadCustomElement({ - customElements: new Map([["remote-text", true]]), - }); - - assert.calledOnce(scriptloaderStub.loadSubScript); - }); - }); - describe("#toggleWhatsNewPref", () => { - it("should call Services.prefs.setBoolPref() with the opposite value", () => { - let checkbox = {}; - let event = { target: checkbox }; - // checkbox starts false - checkbox.checked = false; - - // toggling the checkbox to set the value to true; - // Preferences.set() gets called before the checkbox changes, - // so we have to call it with the opposite value. - instance.toggleWhatsNewPref(event); - - assert.calledOnce(setBoolPrefStub); - assert.calledWith( - setBoolPrefStub, - "browser.messaging-system.whatsNewPanel.enabled", - !checkbox.checked - ); - }); - it("should report telemetry with the opposite value", () => { - let sendUserEventTelemetryStub = sandbox.stub( - instance, - "sendUserEventTelemetry" - ); - let event = { - target: { checked: true, ownerGlobal: fakeWindow }, - }; - - instance.toggleWhatsNewPref(event); - - assert.calledOnce(sendUserEventTelemetryStub); - const { args } = sendUserEventTelemetryStub.firstCall; - assert.equal(args[1], "WNP_PREF_TOGGLE"); - assert.propertyVal(args[3].value, "prefValue", false); - }); - }); - describe("#enableAppmenuButton", () => { - it("should registerCallback on enableAppmenuButton() if there are messages", async () => { - await instance.init(waitForInitializedStub, { - getMessages: sandbox.stub().resolves([{}, {}]), - }); - // init calls `enableAppmenuButton` - everyWindowStub.registerCallback.resetHistory(); - - await instance.enableAppmenuButton(); - - assert.calledOnce(everyWindowStub.registerCallback); - assert.calledWithExactly( - everyWindowStub.registerCallback, - "appMenu-whatsnew-button", - sinon.match.func, - sinon.match.func - ); - }); - it("should not registerCallback on enableAppmenuButton() if there are no messages", async () => { - instance.init(waitForInitializedStub, { - getMessages: sandbox.stub().resolves([]), - }); - // init calls `enableAppmenuButton` - everyWindowStub.registerCallback.resetHistory(); - - await instance.enableAppmenuButton(); - - assert.notCalled(everyWindowStub.registerCallback); - }); - }); - describe("#disableAppmenuButton", () => { - it("should call the unregisterCallback", () => { - assert.notCalled(everyWindowStub.unregisterCallback); - - instance.disableAppmenuButton(); - - assert.calledOnce(everyWindowStub.unregisterCallback); - assert.calledWithExactly( - everyWindowStub.unregisterCallback, - "appMenu-whatsnew-button" - ); - }); - }); - describe("#enableToolbarButton", () => { - it("should registerCallback on enableToolbarButton if messages.length", async () => { - await instance.init(waitForInitializedStub, { - getMessages: sandbox.stub().resolves([{}, {}]), - }); - // init calls `enableAppmenuButton` - everyWindowStub.registerCallback.resetHistory(); - - await instance.enableToolbarButton(); - - assert.calledOnce(everyWindowStub.registerCallback); - assert.calledWithExactly( - everyWindowStub.registerCallback, - "whats-new-menu-button", - sinon.match.func, - sinon.match.func - ); - }); - it("should not registerCallback on enableToolbarButton if no messages", async () => { - await instance.init(waitForInitializedStub, { - getMessages: sandbox.stub().resolves([]), - }); - - await instance.enableToolbarButton(); - - assert.notCalled(everyWindowStub.registerCallback); - }); - }); - describe("Show/Hide functions", () => { - it("should unhide appmenu button on _showAppmenuButton()", async () => { - await instance._showAppmenuButton(fakeWindow); - - assert.equal(fakeElementById.hidden, false); - }); - it("should hide appmenu button on _hideAppmenuButton()", () => { - instance._hideAppmenuButton(fakeWindow); - assert.equal(fakeElementById.hidden, true); - }); - it("should not do anything if the window is closed", () => { - instance._hideAppmenuButton(fakeWindow, true); - assert.notCalled(global.PanelMultiView.getViewNode); - }); - it("should not throw if the element does not exist", () => { - let fn = instance._hideAppmenuButton.bind(null, { - browser: { ownerDocument: {} }, - }); - getViewNodeStub.returns(undefined); - assert.doesNotThrow(fn); - }); - it("should unhide toolbar button on _showToolbarButton()", async () => { - await instance._showToolbarButton(fakeWindow); - - assert.equal(fakeElementById.hidden, false); - }); - it("should hide toolbar button on _hideToolbarButton()", () => { - instance._hideToolbarButton(fakeWindow); - assert.equal(fakeElementById.hidden, true); - }); - }); - describe("#renderMessages", () => { - let getMessagesStub; - beforeEach(() => { - getMessagesStub = sandbox.stub(); - instance.init(waitForInitializedStub, { - getMessages: getMessagesStub, - sendTelemetry: fakeSendTelemetry, - }); - }); - it("should have correct state", async () => { - const messages = (await PanelTestProvider.getMessages()).filter( - m => m.template === "whatsnew_panel_message" - ); - - getMessagesStub.returns(messages); - const ev1 = sandbox.stub(); - ev1.withArgs("type").returns(1); // tracker - ev1.withArgs("count").returns(4); - const ev2 = sandbox.stub(); - ev2.withArgs("type").returns(4); // fingerprinter - ev2.withArgs("count").returns(3); - getEventsByDateRangeStub.returns([ - { getResultByName: ev1 }, - { getResultByName: ev2 }, - ]); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - assert.propertyVal(instance.state.contentArguments, "trackerCount", 4); - assert.propertyVal( - instance.state.contentArguments, - "fingerprinterCount", - 3 - ); - }); - it("should render messages to the panel on renderMessages()", async () => { - const messages = (await PanelTestProvider.getMessages()).filter( - m => m.template === "whatsnew_panel_message" - ); - messages[0].content.link_text = { string_id: "link_text_id" }; - - getMessagesStub.returns(messages); - const ev1 = sandbox.stub(); - ev1.withArgs("type").returns(1); // tracker - ev1.withArgs("count").returns(4); - const ev2 = sandbox.stub(); - ev2.withArgs("type").returns(4); // fingerprinter - ev2.withArgs("count").returns(3); - getEventsByDateRangeStub.returns([ - { getResultByName: ev1 }, - { getResultByName: ev2 }, - ]); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - for (let message of messages) { - assert.ok( - fakeRemoteL10n.createElement.args.find( - ([, , args]) => args && args.classList === "whatsNew-message-title" - ) - ); - if (message.content.layout === "tracking-protections") { - assert.ok( - fakeRemoteL10n.createElement.args.find( - ([, , args]) => - args && args.classList === "whatsNew-message-subtitle" - ) - ); - } - if (message.id === "WHATS_NEW_FINGERPRINTER_COUNTER_72") { - assert.ok( - fakeRemoteL10n.createElement.args.find( - ([, el, args]) => el === "h2" && args.content === 3 - ) - ); - } - assert.ok( - fakeRemoteL10n.createElement.args.find( - ([, , args]) => - args && args.classList === "whatsNew-message-content" - ) - ); - } - // Call the click handler to make coverage happy. - eventListeners.mouseup(); - assert.calledOnce(global.SpecialMessageActions.handleAction); - }); - it("should clear previous messages on 2nd renderMessages()", async () => { - const messages = (await PanelTestProvider.getMessages()).filter( - m => m.template === "whatsnew_panel_message" - ); - const removeStub = sandbox.stub(); - fakeElementById.querySelectorAll.onCall(0).returns([]); - fakeElementById.querySelectorAll - .onCall(1) - .returns([{ remove: removeStub }, { remove: removeStub }]); - - getMessagesStub.returns(messages); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - assert.calledTwice(removeStub); - }); - it("should sort based on order field value", async () => { - const messages = (await PanelTestProvider.getMessages()).filter( - m => - m.template === "whatsnew_panel_message" && - m.content.published_date === 1560969794394 - ); - - messages.forEach(m => (m.content.title = m.order)); - - getMessagesStub.returns(messages); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - // Select the title elements that are supposed to be set to the same - // value as the `order` field of the message - const titleEls = fakeRemoteL10n.createElement.args - .filter( - ([, , args]) => args && args.classList === "whatsNew-message-title" - ) - .map(([, , args]) => args.content); - assert.deepEqual(titleEls, [1, 2, 3]); - }); - it("should accept string for image attributes", async () => { - const messages = (await PanelTestProvider.getMessages()).filter( - m => m.id === "WHATS_NEW_70_1" - ); - getMessagesStub.returns(messages); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - const imageEl = createdCustomElements.find(el => el.tagName === "img"); - assert.calledOnce(imageEl.setAttribute); - assert.calledWithExactly( - imageEl.setAttribute, - "alt", - "Firefox Send Logo" - ); - }); - it("should set state values as data-attribute", async () => { - const message = (await PanelTestProvider.getMessages()).find( - m => m.template === "whatsnew_panel_message" - ); - getMessagesStub.returns([message]); - instance.state.contentArguments = { foo: "foo", bar: "bar" }; - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - const [, , args] = fakeRemoteL10n.createElement.args.find( - ([, , elArgs]) => elArgs && elArgs.attributes - ); - assert.ok(args); - // Currently this.state.contentArguments has 8 different entries - assert.lengthOf(Object.keys(args.attributes), 8); - assert.equal( - args.attributes.searchEngineName, - defaultSearchStub.defaultEngine.name - ); - }); - it("should only render unique dates (no duplicates)", async () => { - const messages = (await PanelTestProvider.getMessages()).filter( - m => m.template === "whatsnew_panel_message" - ); - const uniqueDates = [ - ...new Set(messages.map(m => m.content.published_date)), - ]; - getMessagesStub.returns(messages); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - const dateElements = fakeRemoteL10n.createElement.args.filter( - ([, el, args]) => - el === "p" && args.classList === "whatsNew-message-date" - ); - assert.lengthOf(dateElements, uniqueDates.length); - }); - it("should listen for panelhidden and remove the toolbar button", async () => { - getMessagesStub.returns([]); - fakeDocument.getElementById - .withArgs("customizationui-widget-panel") - .returns(null); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - assert.notCalled(fakeElementById.addEventListener); - }); - it("should attach doCommand cbs that handle user actions", async () => { - const messages = (await PanelTestProvider.getMessages()).filter( - m => m.template === "whatsnew_panel_message" - ); - getMessagesStub.returns(messages); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - const messageEl = createdCustomElements.find( - el => - el.tagName === "div" && el.classList.includes("whatsNew-message-body") - ); - const anchorEl = createdCustomElements.find(el => el.tagName === "a"); - - assert.notCalled(global.SpecialMessageActions.handleAction); - - messageEl.doCommand(); - anchorEl.doCommand(); - - assert.calledTwice(global.SpecialMessageActions.handleAction); - }); - it("should listen for panelhidden and remove the toolbar button", async () => { - getMessagesStub.returns([]); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - assert.calledOnce(fakeElementById.addEventListener); - assert.calledWithExactly( - fakeElementById.addEventListener, - "popuphidden", - sinon.match.func, - { - once: true, - } - ); - const [, cb] = fakeElementById.addEventListener.firstCall.args; - - assert.notCalled(everyWindowStub.unregisterCallback); - - cb(); - - assert.calledOnce(everyWindowStub.unregisterCallback); - assert.calledWithExactly( - everyWindowStub.unregisterCallback, - "whats-new-menu-button" - ); - }); - describe("#IMPRESSION", () => { - it("should dispatch a IMPRESSION for messages", async () => { - // means panel is triggered from the toolbar button - fakeElementById.hasAttribute.returns(true); - const messages = (await PanelTestProvider.getMessages()).filter( - m => m.template === "whatsnew_panel_message" - ); - getMessagesStub.returns(messages); - const spy = sandbox.spy(instance, "sendUserEventTelemetry"); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - assert.calledOnce(spy); - assert.calledOnce(fakeSendTelemetry); - assert.propertyVal( - spy.firstCall.args[2], - "id", - messages - .map(({ id }) => id) - .sort() - .join(",") - ); - }); - it("should dispatch a CLICK for clicking a message", async () => { - // means panel is triggered from the toolbar button - fakeElementById.hasAttribute.returns(true); - // Force to render the message - fakeElementById.querySelector.returns(null); - const messages = (await PanelTestProvider.getMessages()).filter( - m => m.template === "whatsnew_panel_message" - ); - getMessagesStub.returns([messages[0]]); - const spy = sandbox.spy(instance, "sendUserEventTelemetry"); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - assert.calledOnce(spy); - assert.calledOnce(fakeSendTelemetry); - - spy.resetHistory(); - - // Message click event listener cb - eventListeners.mouseup(); - - assert.calledOnce(spy); - assert.calledWithExactly(spy, fakeWindow, "CLICK", messages[0]); - }); - it("should dispatch a IMPRESSION with toolbar_dropdown", async () => { - // means panel is triggered from the toolbar button - fakeElementById.hasAttribute.returns(true); - const messages = (await PanelTestProvider.getMessages()).filter( - m => m.template === "whatsnew_panel_message" - ); - getMessagesStub.resolves(messages); - const spy = sandbox.spy(instance, "sendUserEventTelemetry"); - const panelPingId = messages - .map(({ id }) => id) - .sort() - .join(","); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - assert.calledOnce(spy); - assert.calledWithExactly( - spy, - fakeWindow, - "IMPRESSION", - { - id: panelPingId, - }, - { - value: { - view: "toolbar_dropdown", - }, - } - ); - assert.calledOnce(fakeSendTelemetry); - const { - args: [dispatchPayload], - } = fakeSendTelemetry.lastCall; - assert.propertyVal(dispatchPayload, "type", "TOOLBAR_PANEL_TELEMETRY"); - assert.propertyVal(dispatchPayload.data, "message_id", panelPingId); - assert.deepEqual(dispatchPayload.data.event_context, { - view: "toolbar_dropdown", - }); - }); - it("should dispatch a IMPRESSION with application_menu", async () => { - // means panel is triggered as a subview in the application menu - fakeElementById.hasAttribute.returns(false); - const messages = (await PanelTestProvider.getMessages()).filter( - m => m.template === "whatsnew_panel_message" - ); - getMessagesStub.resolves(messages); - const spy = sandbox.spy(instance, "sendUserEventTelemetry"); - const panelPingId = messages - .map(({ id }) => id) - .sort() - .join(","); - - await instance.renderMessages(fakeWindow, fakeDocument, "container-id"); - - assert.calledOnce(spy); - assert.calledWithExactly( - spy, - fakeWindow, - "IMPRESSION", - { - id: panelPingId, - }, - { - value: { - view: "application_menu", - }, - } - ); - assert.calledOnce(fakeSendTelemetry); - const { - args: [dispatchPayload], - } = fakeSendTelemetry.lastCall; - assert.propertyVal(dispatchPayload, "type", "TOOLBAR_PANEL_TELEMETRY"); - assert.propertyVal(dispatchPayload.data, "message_id", panelPingId); - assert.deepEqual(dispatchPayload.data.event_context, { - view: "application_menu", - }); - }); - }); - describe("#forceShowMessage", () => { - const panelSelector = "PanelUI-whatsNew-message-container"; - let removeMessagesSpy; - let renderMessagesStub; - let addEventListenerStub; - let messages; - let browser; - beforeEach(async () => { - messages = (await PanelTestProvider.getMessages()).find( - m => m.id === "WHATS_NEW_70_1" - ); - removeMessagesSpy = sandbox.spy(instance, "removeMessages"); - renderMessagesStub = sandbox.spy(instance, "renderMessages"); - addEventListenerStub = fakeElementById.addEventListener; - browser = { ownerGlobal: fakeWindow, ownerDocument: fakeDocument }; - fakeElementById.querySelectorAll.returns([fakeElementById]); - }); - it("should call removeMessages when forcing a message to show", () => { - instance.forceShowMessage(browser, messages); - - assert.calledWithExactly(removeMessagesSpy, fakeWindow, panelSelector); - }); - it("should call renderMessages when forcing a message to show", () => { - instance.forceShowMessage(browser, messages); - - assert.calledOnce(renderMessagesStub); - assert.calledWithExactly( - renderMessagesStub, - fakeWindow, - fakeDocument, - panelSelector, - { - force: true, - messages: Array.isArray(messages) ? messages : [messages], - } - ); - }); - it("should cleanup after the panel is hidden when forcing a message to show", () => { - instance.forceShowMessage(browser, messages); - - assert.calledOnce(addEventListenerStub); - assert.calledWithExactly( - addEventListenerStub, - "popuphidden", - sinon.match.func - ); - - const [, cb] = addEventListenerStub.firstCall.args; - // Reset the call count from the first `forceShowMessage` call - removeMessagesSpy.resetHistory(); - cb({ target: { ownerGlobal: fakeWindow } }); - - assert.calledOnce(removeMessagesSpy); - assert.calledWithExactly(removeMessagesSpy, fakeWindow, panelSelector); - }); - it("should exit gracefully if called before a browser exists", () => { - instance.forceShowMessage(null, messages); - assert.neverCalledWith(removeMessagesSpy, fakeWindow, panelSelector); - }); - }); - }); -}); diff --git a/browser/components/asrouter/tests/unit/content-src/components/ASRouterAdmin.test.jsx b/browser/components/asrouter/tests/unit/content-src/components/ASRouterAdmin.test.jsx index 46d5704107..c5b0d09b39 100644 --- a/browser/components/asrouter/tests/unit/content-src/components/ASRouterAdmin.test.jsx +++ b/browser/components/asrouter/tests/unit/content-src/components/ASRouterAdmin.test.jsx @@ -1,4 +1,7 @@ -import { ASRouterAdminInner } from "content-src/components/ASRouterAdmin/ASRouterAdmin"; +import { + ASRouterAdminInner, + toBinary, +} from "content-src/components/ASRouterAdmin/ASRouterAdmin"; import { ASRouterUtils } from "content-src/asrouter-utils"; import { GlobalOverrider } from "test/unit/utils"; import React from "react"; @@ -259,4 +262,43 @@ describe("ASRouterAdmin", () => { }); }); }); + describe("toBinary", () => { + // Bringing the 'fromBinary' function over from + // messagepreview to prove it works + function fromBinary(encoded) { + const binary = atob(decodeURIComponent(encoded)); + const bytes = new Uint8Array(binary.length); + for (let i = 0; i < bytes.length; i++) { + bytes[i] = binary.charCodeAt(i); + } + return String.fromCharCode(...new Uint16Array(bytes.buffer)); + } + + it("correctly encodes a latin string", () => { + const testString = "Hi I am a test string"; + const expectedResult = + "SABpACAASQAgAGEAbQAgAGEAIAB0AGUAcwB0ACAAcwB0AHIAaQBuAGcA"; + + const encodedResult = toBinary(testString); + + assert.equal(encodedResult, expectedResult); + + const decodedResult = fromBinary(encodedResult); + + assert.equal(decodedResult, testString); + }); + + it("correctly encodes a non-latin string", () => { + const nonLatinString = "тестовое сообщение"; + const expectedResult = "QgQ1BEEEQgQ+BDIEPgQ1BCAAQQQ+BD4EMQRJBDUEPQQ4BDUE"; + + const encodedResult = toBinary("тестовое сообщение"); + + assert.equal(encodedResult, expectedResult); + + const decodedResult = fromBinary(encodedResult); + + assert.equal(decodedResult, nonLatinString); + }); + }); }); diff --git a/browser/components/asrouter/tests/unit/unit-entry.js b/browser/components/asrouter/tests/unit/unit-entry.js index f2046a81cb..2464b02c58 100644 --- a/browser/components/asrouter/tests/unit/unit-entry.js +++ b/browser/components/asrouter/tests/unit/unit-entry.js @@ -14,7 +14,7 @@ import FxMSCommonSchema from "../../content-src/schemas/FxMSCommon.schema.json"; import { MESSAGE_TYPE_LIST, MESSAGE_TYPE_HASH, -} from "modules/ActorConstants.sys.mjs"; +} from "modules/ActorConstants.mjs"; enzyme.configure({ adapter: new Adapter() }); |