From 2f3edaad72cc0d0f7dbb6f7412dcc8b4c4b51eee Mon Sep 17 00:00:00 2001 From: cd-bitwarden <106776772+cd-bitwarden@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:53:00 -0500 Subject: [PATCH] fix --- .../services/account-switcher.service.spec.ts | 6 +-- .../auto-submit-login.background.spec.ts | 33 +++++++++----- .../background/overlay.background.spec.ts | 2 +- .../context-menu-clicked-handler.spec.ts | 12 ++--- .../autofill/content/autofill-init.spec.ts | 2 +- .../list/autofill-inline-menu-list.spec.ts | 40 ++++++++--------- .../collect-autofill-content.service.spec.ts | 44 +++++++++++-------- .../insert-autofill-content.service.spec.ts | 4 +- .../decorators/dev-flag.decorator.spec.ts | 4 +- .../browser-platform-utils.service.spec.ts | 8 ++-- 10 files changed, 85 insertions(+), 70 deletions(-) diff --git a/apps/browser/src/auth/popup/account-switching/services/account-switcher.service.spec.ts b/apps/browser/src/auth/popup/account-switching/services/account-switcher.service.spec.ts index 4bacd453803..11ceb894845 100644 --- a/apps/browser/src/auth/popup/account-switching/services/account-switcher.service.spec.ts +++ b/apps/browser/src/auth/popup/account-switching/services/account-switcher.service.spec.ts @@ -176,7 +176,7 @@ describe("AccountSwitcherService", () => { expect(messagingService.send).toHaveBeenCalledWith("switchAccount", { userId: null }); - expect(removeListenerSpy).toBeCalledTimes(1); + expect(removeListenerSpy).toHaveBeenCalledTimes(1); }); it("initiates an account switch with an account id", async () => { @@ -198,13 +198,13 @@ describe("AccountSwitcherService", () => { await selectAccountPromise; expect(messagingService.send).toHaveBeenCalledWith("switchAccount", { userId: "1" }); - expect(messagingService.send).toBeCalledWith( + expect(messagingService.send).toHaveBeenCalledWith( "switchAccount", matches((payload) => { return payload.userId === "1"; }), ); - expect(removeListenerSpy).toBeCalledTimes(1); + expect(removeListenerSpy).toHaveBeenCalledTimes(1); }); }); }); diff --git a/apps/browser/src/autofill/background/auto-submit-login.background.spec.ts b/apps/browser/src/autofill/background/auto-submit-login.background.spec.ts index 82a907a9e43..d13f2ad8e23 100644 --- a/apps/browser/src/autofill/background/auto-submit-login.background.spec.ts +++ b/apps/browser/src/autofill/background/auto-submit-login.background.spec.ts @@ -130,9 +130,12 @@ describe("AutoSubmitLoginBackground", () => { url: validAutoSubmitUrl, tabId: webRequestDetails.tabId, }); - expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith(expect.any(Function), { - url: [{ hostEquals: validAutoSubmitHost }], - }); + expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith( + expect.any(Function), + { + url: [{ hostEquals: validAutoSubmitHost }], + }, + ); }); it("sets up the auto-submit workflow when the web request occurs in a sub frame and the initiator of the request is a valid auto-submit host", async () => { @@ -145,9 +148,12 @@ describe("AutoSubmitLoginBackground", () => { triggerWebRequestOnBeforeRequestEvent(webRequestDetails); - expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith(expect.any(Function), { - url: [{ hostEquals: subFrameHost }], - }); + expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith( + expect.any(Function), + { + url: [{ hostEquals: subFrameHost }], + }, + ); }); describe("injecting the auto-submit login content script", () => { @@ -182,7 +188,7 @@ describe("AutoSubmitLoginBackground", () => { triggerWebNavigationOnCompletedEvent(webNavigationDetails); await flushPromises(); - expect(scriptInjectorService.inject).toBeCalledWith({ + expect(scriptInjectorService.inject).toHaveBeenCalledWith({ tabId: webRequestDetails.tabId, injectDetails: { file: "content/auto-submit-login.js", @@ -306,7 +312,7 @@ describe("AutoSubmitLoginBackground", () => { triggerWebRequestOnBeforeRequestEvent(webRequestDetails); - expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith( + expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith( autoSubmitLoginBackground["handleAutoSubmitHostNavigationCompleted"], { url: [{ hostEquals: validAutoSubmitHost }] }, ); @@ -426,9 +432,12 @@ describe("AutoSubmitLoginBackground", () => { }), ); - expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith(expect.any(Function), { - url: [{ hostEquals: validAutoSubmitHost }], - }); + expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith( + expect.any(Function), + { + url: [{ hostEquals: validAutoSubmitHost }], + }, + ); }); }); @@ -477,7 +486,7 @@ describe("AutoSubmitLoginBackground", () => { sendMockExtensionMessage(message, sender); await flushPromises(); - expect(autofillService.doAutoFillOnTab).toBeCalledWith( + expect(autofillService.doAutoFillOnTab).toHaveBeenCalledWith( [ { frameId: sender.frameId, diff --git a/apps/browser/src/autofill/background/overlay.background.spec.ts b/apps/browser/src/autofill/background/overlay.background.spec.ts index 80e453e9e83..9925f6d9722 100644 --- a/apps/browser/src/autofill/background/overlay.background.spec.ts +++ b/apps/browser/src/autofill/background/overlay.background.spec.ts @@ -2878,7 +2878,7 @@ describe("OverlayBackground", () => { { command: "closeAutofillInlineMenu", overlayElement: undefined }, { frameId: 0 }, ); - expect(tabSendMessageDataSpy).toBeCalledWith( + expect(tabSendMessageDataSpy).toHaveBeenCalledWith( sender.tab, "addToLockedVaultPendingNotifications", { diff --git a/apps/browser/src/autofill/browser/context-menu-clicked-handler.spec.ts b/apps/browser/src/autofill/browser/context-menu-clicked-handler.spec.ts index 61d6b9dc480..b1348736a1e 100644 --- a/apps/browser/src/autofill/browser/context-menu-clicked-handler.spec.ts +++ b/apps/browser/src/autofill/browser/context-menu-clicked-handler.spec.ts @@ -105,9 +105,9 @@ describe("ContextMenuClickedHandler", () => { it("can generate password", async () => { await sut.run(createData(GENERATE_PASSWORD_ID), { id: 5 } as any); - expect(generatePasswordToClipboard).toBeCalledTimes(1); + expect(generatePasswordToClipboard).toHaveBeenCalledTimes(1); - expect(generatePasswordToClipboard).toBeCalledWith({ + expect(generatePasswordToClipboard).toHaveBeenCalledWith({ id: 5, }); }); @@ -118,9 +118,9 @@ describe("ContextMenuClickedHandler", () => { await sut.run(createData(`${AUTOFILL_ID}_1`, AUTOFILL_ID), { id: 5 } as any); - expect(autofill).toBeCalledTimes(1); + expect(autofill).toHaveBeenCalledTimes(1); - expect(autofill).toBeCalledWith({ id: 5 }, cipher); + expect(autofill).toHaveBeenCalledWith({ id: 5 }, cipher); }); it("copies username to clipboard", async () => { @@ -132,7 +132,7 @@ describe("ContextMenuClickedHandler", () => { url: "https://test.com", } as any); - expect(copyToClipboard).toBeCalledTimes(1); + expect(copyToClipboard).toHaveBeenCalledTimes(1); expect(copyToClipboard).toHaveBeenCalledWith({ text: "TEST_USERNAME", @@ -149,7 +149,7 @@ describe("ContextMenuClickedHandler", () => { url: "https://test.com", } as any); - expect(copyToClipboard).toBeCalledTimes(1); + expect(copyToClipboard).toHaveBeenCalledTimes(1); expect(copyToClipboard).toHaveBeenCalledWith({ text: "TEST_PASSWORD", diff --git a/apps/browser/src/autofill/content/autofill-init.spec.ts b/apps/browser/src/autofill/content/autofill-init.spec.ts index d612e63f82c..8effe390d10 100644 --- a/apps/browser/src/autofill/content/autofill-init.spec.ts +++ b/apps/browser/src/autofill/content/autofill-init.spec.ts @@ -248,7 +248,7 @@ describe("AutofillInit", () => { await flushPromises(); expect(autofillInit["collectAutofillContentService"].getPageDetails).toHaveBeenCalled(); - expect(sendResponse).toBeCalledWith(pageDetails); + expect(sendResponse).toHaveBeenCalledWith(pageDetails); expect(chrome.runtime.sendMessage).not.toHaveBeenCalledWith({ command: "collectPageDetailsResponse", tab: message.tab, diff --git a/apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.spec.ts b/apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.spec.ts index b4e480797da..59abaa75816 100644 --- a/apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.spec.ts +++ b/apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.spec.ts @@ -372,7 +372,7 @@ describe("AutofillInlineMenuList", () => { firstFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" })); - expect((secondFillCipherElement as HTMLElement).focus).toBeCalled(); + expect((secondFillCipherElement as HTMLElement).focus).toHaveBeenCalled(); }); it("directs focus to the first item in the cipher list if no cipher is present after the current one when pressing ArrowDown and no new item button exists", () => { @@ -386,7 +386,7 @@ describe("AutofillInlineMenuList", () => { lastFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" })); - expect((firstFillCipherElement as HTMLElement).focus).toBeCalled(); + expect((firstFillCipherElement as HTMLElement).focus).toHaveBeenCalled(); }); it("directs focus to the new item button if no cipher is present after the current one when pressing ArrowDown", async () => { @@ -406,7 +406,7 @@ describe("AutofillInlineMenuList", () => { lastFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" })); - expect(autofillInlineMenuList["newItemButtonElement"].focus).toBeCalled(); + expect(autofillInlineMenuList["newItemButtonElement"].focus).toHaveBeenCalled(); }); it("allows the user to move keyboard focus to the previous cipher element on ArrowUp", () => { @@ -420,7 +420,7 @@ describe("AutofillInlineMenuList", () => { secondFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" })); - expect((firstFillCipherElement as HTMLElement).focus).toBeCalled(); + expect((firstFillCipherElement as HTMLElement).focus).toHaveBeenCalled(); }); it("directs focus to the last item in the cipher list if no cipher is present before the current one when pressing ArrowUp", () => { @@ -434,7 +434,7 @@ describe("AutofillInlineMenuList", () => { firstFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" })); - expect((lastFillCipherElement as HTMLElement).focus).toBeCalled(); + expect((lastFillCipherElement as HTMLElement).focus).toHaveBeenCalled(); }); it("directs focus to the new item button if no cipher is present before the current one when pressing ArrowUp", async () => { @@ -454,7 +454,7 @@ describe("AutofillInlineMenuList", () => { firstFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" })); - expect(autofillInlineMenuList["newItemButtonElement"].focus).toBeCalled(); + expect(autofillInlineMenuList["newItemButtonElement"].focus).toHaveBeenCalled(); }); it("allows the user to move keyboard focus to the view cipher button on ArrowRight", () => { @@ -466,7 +466,7 @@ describe("AutofillInlineMenuList", () => { fillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowRight" })); - expect((viewCipherButton as HTMLElement).focus).toBeCalled(); + expect((viewCipherButton as HTMLElement).focus).toHaveBeenCalled(); }); it("ignores keyup events that do not include ArrowUp, ArrowDown, or ArrowRight", () => { @@ -476,7 +476,7 @@ describe("AutofillInlineMenuList", () => { fillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowLeft" })); - expect((fillCipherElement as HTMLElement).focus).not.toBeCalled(); + expect((fillCipherElement as HTMLElement).focus).not.toHaveBeenCalled(); }); }); @@ -506,7 +506,7 @@ describe("AutofillInlineMenuList", () => { viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowLeft" })); - expect((fillCipherButton as HTMLElement).focus).toBeCalled(); + expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled(); }); it("allows the user to move keyboard to the next cipher element on ArrowDown", () => { @@ -519,7 +519,7 @@ describe("AutofillInlineMenuList", () => { viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" })); - expect((secondFillCipherButton as HTMLElement).focus).toBeCalled(); + expect((secondFillCipherButton as HTMLElement).focus).toHaveBeenCalled(); }); it("allows the user to move keyboard focus to the previous cipher element on ArrowUp", () => { @@ -532,7 +532,7 @@ describe("AutofillInlineMenuList", () => { viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" })); - expect((firstFillCipherButton as HTMLElement).focus).toBeCalled(); + expect((firstFillCipherButton as HTMLElement).focus).toHaveBeenCalled(); }); it("ignores keyup events that do not include ArrowUp, ArrowDown, or ArrowRight", () => { @@ -542,7 +542,7 @@ describe("AutofillInlineMenuList", () => { viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowRight" })); - expect((viewCipherButton as HTMLElement).focus).not.toBeCalled(); + expect((viewCipherButton as HTMLElement).focus).not.toHaveBeenCalled(); }); }); @@ -769,7 +769,7 @@ describe("AutofillInlineMenuList", () => { viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" })); - expect((fillCipherButton as HTMLElement).focus).toBeCalled(); + expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled(); }); it("skips the passkeys heading when the user presses ArrowDown to focus the first list item", () => { @@ -781,7 +781,7 @@ describe("AutofillInlineMenuList", () => { viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" })); - expect((fillCipherButton as HTMLElement).focus).toBeCalled(); + expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled(); }); it("skips the logins heading when the user presses ArrowUp to focus the previous list item", () => { @@ -793,7 +793,7 @@ describe("AutofillInlineMenuList", () => { viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" })); - expect((fillCipherButton as HTMLElement).focus).toBeCalled(); + expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled(); }); }); }); @@ -875,7 +875,7 @@ describe("AutofillInlineMenuList", () => { new KeyboardEvent("keyup", { code: "ArrowRight" }), ); - expect((refreshGeneratedPasswordButton as HTMLElement).focus).toBeCalled(); + expect((refreshGeneratedPasswordButton as HTMLElement).focus).toHaveBeenCalled(); }); }); }); @@ -945,7 +945,7 @@ describe("AutofillInlineMenuList", () => { new KeyboardEvent("keyup", { code: "ArrowLeft" }), ); - expect((fillGeneratedPasswordButton as HTMLElement).focus).toBeCalled(); + expect((fillGeneratedPasswordButton as HTMLElement).focus).toHaveBeenCalled(); }); }); }); @@ -1163,7 +1163,7 @@ describe("AutofillInlineMenuList", () => { postWindowMessage({ command: "focusAutofillInlineMenuList" }); - expect((unlockButton as HTMLElement).focus).toBeCalled(); + expect((unlockButton as HTMLElement).focus).toHaveBeenCalled(); }); it("focuses the new item button element if the cipher list is empty", async () => { @@ -1175,7 +1175,7 @@ describe("AutofillInlineMenuList", () => { postWindowMessage({ command: "focusAutofillInlineMenuList" }); - expect((newItemButton as HTMLElement).focus).toBeCalled(); + expect((newItemButton as HTMLElement).focus).toHaveBeenCalled(); }); it("focuses the first cipher button element if the cipher list is populated", () => { @@ -1186,7 +1186,7 @@ describe("AutofillInlineMenuList", () => { postWindowMessage({ command: "focusAutofillInlineMenuList" }); - expect((firstCipherItem as HTMLElement).focus).toBeCalled(); + expect((firstCipherItem as HTMLElement).focus).toHaveBeenCalled(); }); }); diff --git a/apps/browser/src/autofill/services/collect-autofill-content.service.spec.ts b/apps/browser/src/autofill/services/collect-autofill-content.service.spec.ts index 9ee329fa150..64239453bdf 100644 --- a/apps/browser/src/autofill/services/collect-autofill-content.service.spec.ts +++ b/apps/browser/src/autofill/services/collect-autofill-content.service.spec.ts @@ -2076,7 +2076,7 @@ describe("CollectAutofillContentService", () => { collectAutofillContentService["setupMutationObserver"](); expect(collectAutofillContentService["mutationObserver"]).toBeInstanceOf(MutationObserver); - expect(collectAutofillContentService["mutationObserver"].observe).toBeCalled(); + expect(collectAutofillContentService["mutationObserver"].observe).toHaveBeenCalled(); }); }); @@ -2114,11 +2114,11 @@ describe("CollectAutofillContentService", () => { expect(collectAutofillContentService["domRecentlyMutated"]).toEqual(true); expect(collectAutofillContentService["noFieldsFound"]).toEqual(false); - expect(collectAutofillContentService["isAutofillElementNodeMutated"]).toBeCalledWith( + expect(collectAutofillContentService["isAutofillElementNodeMutated"]).toHaveBeenCalledWith( removedNodes, true, ); - expect(collectAutofillContentService["isAutofillElementNodeMutated"]).toBeCalledWith( + expect(collectAutofillContentService["isAutofillElementNodeMutated"]).toHaveBeenCalledWith( addedNodes, ); }); @@ -2183,8 +2183,10 @@ describe("CollectAutofillContentService", () => { expect(collectAutofillContentService["domRecentlyMutated"]).toEqual(false); expect(collectAutofillContentService["noFieldsFound"]).toEqual(true); - expect(collectAutofillContentService["isAutofillElementNodeMutated"]).not.toBeCalled(); - expect(collectAutofillContentService["handleAutofillElementAttributeMutation"]).toBeCalled(); + expect(collectAutofillContentService["isAutofillElementNodeMutated"]).not.toHaveBeenCalled(); + expect( + collectAutofillContentService["handleAutofillElementAttributeMutation"], + ).toHaveBeenCalled(); }); it("will handle window location mutations", () => { @@ -2206,11 +2208,11 @@ describe("CollectAutofillContentService", () => { collectAutofillContentService["handleMutationObserverMutation"]([mutationRecord]); - expect(collectAutofillContentService["handleWindowLocationMutation"]).toBeCalled(); - expect(collectAutofillContentService["isAutofillElementNodeMutated"]).not.toBeCalled(); + expect(collectAutofillContentService["handleWindowLocationMutation"]).toHaveBeenCalled(); + expect(collectAutofillContentService["isAutofillElementNodeMutated"]).not.toHaveBeenCalled(); expect( collectAutofillContentService["handleAutofillElementAttributeMutation"], - ).not.toBeCalled(); + ).not.toHaveBeenCalled(); }); it("will setup the overlay listeners on mutated elements", async () => { @@ -2238,7 +2240,9 @@ describe("CollectAutofillContentService", () => { collectAutofillContentService["handleMutationObserverMutation"]([mutationRecord]); jest.runAllTimers(); - expect(collectAutofillContentService["setupOverlayListenersOnMutatedElements"]).toBeCalled(); + expect( + collectAutofillContentService["setupOverlayListenersOnMutatedElements"], + ).toHaveBeenCalled(); }); }); @@ -2250,7 +2254,7 @@ describe("CollectAutofillContentService", () => { collectAutofillContentService["setupOverlayListenersOnMutatedElements"](nodes); - expect(collectAutofillContentService["buildAutofillFieldItem"]).not.toBeCalled(); + expect(collectAutofillContentService["buildAutofillFieldItem"]).not.toHaveBeenCalled(); }); it("skips building the autofill field item if the node is already a field element", () => { @@ -2264,7 +2268,7 @@ describe("CollectAutofillContentService", () => { collectAutofillContentService["setupOverlayListenersOnMutatedElements"](nodes); - expect(collectAutofillContentService["buildAutofillFieldItem"]).not.toBeCalled(); + expect(collectAutofillContentService["buildAutofillFieldItem"]).not.toHaveBeenCalled(); }); }); @@ -2329,7 +2333,9 @@ describe("CollectAutofillContentService", () => { expect(collectAutofillContentService["currentLocationHref"]).toEqual(window.location.href); expect(collectAutofillContentService["domRecentlyMutated"]).toEqual(true); expect(collectAutofillContentService["noFieldsFound"]).toEqual(false); - expect(collectAutofillContentService["updateAutofillElementsAfterMutation"]).toBeCalled(); + expect( + collectAutofillContentService["updateAutofillElementsAfterMutation"], + ).toHaveBeenCalled(); expect(collectAutofillContentService["_autofillFormElements"].size).toEqual(0); expect(collectAutofillContentService["autofillFieldElements"].size).toEqual(0); }); @@ -2352,7 +2358,7 @@ describe("CollectAutofillContentService", () => { collectAutofillContentService["handleAutofillElementAttributeMutation"](mutationRecord); - expect(collectAutofillContentService["isAutofillElementNodeMutated"]).not.toBeCalled(); + expect(collectAutofillContentService["isAutofillElementNodeMutated"]).not.toHaveBeenCalled(); }); it("will update the autofill form element data if the target node can be found in the autofillFormElements map", () => { @@ -2384,7 +2390,7 @@ describe("CollectAutofillContentService", () => { collectAutofillContentService["handleAutofillElementAttributeMutation"](mutationRecord); - expect(collectAutofillContentService["updateAutofillFormElementData"]).toBeCalledWith( + expect(collectAutofillContentService["updateAutofillFormElementData"]).toHaveBeenCalledWith( mutationRecord.attributeName, mutationRecord.target, autofillForm, @@ -2431,7 +2437,7 @@ describe("CollectAutofillContentService", () => { collectAutofillContentService["handleAutofillElementAttributeMutation"](mutationRecord); - expect(collectAutofillContentService["updateAutofillFieldElementData"]).toBeCalledWith( + expect(collectAutofillContentService["updateAutofillFieldElementData"]).toHaveBeenCalledWith( mutationRecord.attributeName, mutationRecord.target, autofillField, @@ -2466,7 +2472,7 @@ describe("CollectAutofillContentService", () => { autofillForm, ); - expect(collectAutofillContentService["_autofillFormElements"].set).toBeCalledWith( + expect(collectAutofillContentService["_autofillFormElements"].set).toHaveBeenCalledWith( formElement, autofillForm, ); @@ -2482,7 +2488,7 @@ describe("CollectAutofillContentService", () => { autofillForm, ); - expect(collectAutofillContentService["_autofillFormElements"].set).not.toBeCalled(); + expect(collectAutofillContentService["_autofillFormElements"].set).not.toHaveBeenCalled(); }); }); @@ -2537,7 +2543,7 @@ describe("CollectAutofillContentService", () => { autofillField, ); - expect(collectAutofillContentService["autofillFieldElements"].set).toBeCalledWith( + expect(collectAutofillContentService["autofillFieldElements"].set).toHaveBeenCalledWith( fieldElement, autofillField, ); @@ -2553,7 +2559,7 @@ describe("CollectAutofillContentService", () => { autofillField, ); - expect(collectAutofillContentService["autofillFieldElements"].set).not.toBeCalled(); + expect(collectAutofillContentService["autofillFieldElements"].set).not.toHaveBeenCalled(); }); }); diff --git a/apps/browser/src/autofill/services/insert-autofill-content.service.spec.ts b/apps/browser/src/autofill/services/insert-autofill-content.service.spec.ts index 1f2b23021f4..d2048dcb686 100644 --- a/apps/browser/src/autofill/services/insert-autofill-content.service.spec.ts +++ b/apps/browser/src/autofill/services/insert-autofill-content.service.spec.ts @@ -482,7 +482,7 @@ describe("InsertAutofillContentService", () => { expect( insertAutofillContentService["collectAutofillContentService"].getAutofillFieldElementByOpid, - ).toBeCalledWith("__1"); + ).toHaveBeenCalledWith("__1"); expect((insertAutofillContentService as any)["triggerClickOnElement"]).toHaveBeenCalledWith( textInput, ); @@ -547,7 +547,7 @@ describe("InsertAutofillContentService", () => { expect( insertAutofillContentService["collectAutofillContentService"].getAutofillFieldElementByOpid, - ).toBeCalledWith("__0"); + ).toHaveBeenCalledWith("__0"); expect(targetInput.blur).not.toHaveBeenCalled(); expect( insertAutofillContentService["simulateUserMouseClickAndFocusEventInteractions"], diff --git a/apps/browser/src/platform/decorators/dev-flag.decorator.spec.ts b/apps/browser/src/platform/decorators/dev-flag.decorator.spec.ts index da00bc6fe30..98a55087865 100644 --- a/apps/browser/src/platform/decorators/dev-flag.decorator.spec.ts +++ b/apps/browser/src/platform/decorators/dev-flag.decorator.spec.ts @@ -23,13 +23,13 @@ describe("devFlag decorator", () => { devFlagEnabledMock.mockReturnValue(false); expect(() => { new TestClass().test(); - }).toThrowError("This method should not be called, it is protected by a disabled dev flag."); + }).toThrow("This method should not be called, it is protected by a disabled dev flag."); }); it("should not throw an error if the dev flag is enabled", () => { devFlagEnabledMock.mockReturnValue(true); expect(() => { new TestClass().test(); - }).not.toThrowError(); + }).not.toThrow(); }); }); diff --git a/apps/browser/src/platform/services/platform-utils/browser-platform-utils.service.spec.ts b/apps/browser/src/platform/services/platform-utils/browser-platform-utils.service.spec.ts index 61e56f08e16..9b24076f6ef 100644 --- a/apps/browser/src/platform/services/platform-utils/browser-platform-utils.service.spec.ts +++ b/apps/browser/src/platform/services/platform-utils/browser-platform-utils.service.spec.ts @@ -324,8 +324,8 @@ describe("Browser Utils Service", () => { BrowserApi.sendMessageWithResponse = jest.fn(); offscreenDocumentService.offscreenApiSupported.mockReturnValue(true); getManifestVersionSpy.mockReturnValue(3); - offscreenDocumentService.withDocument.mockImplementationOnce((_, __, callback) => - Promise.resolve("test"), + offscreenDocumentService.withDocument.mockImplementationOnce(async (_, __, callback) => + callback(), ); await browserPlatformUtilsService.readFromClipboard(); @@ -347,8 +347,8 @@ describe("Browser Utils Service", () => { .mockReturnValue(DeviceType.ChromeExtension); getManifestVersionSpy.mockReturnValue(3); jest.spyOn(BrowserApi, "sendMessageWithResponse").mockResolvedValue(1); - offscreenDocumentService.withDocument.mockImplementationOnce((_, __, callback) => - Promise.resolve(1), + offscreenDocumentService.withDocument.mockImplementationOnce(async (_, __, callback) => + callback(), ); const result = await browserPlatformUtilsService.readFromClipboard();