Skip to content

Commit 2f3edaa

Browse files
committed
fix
1 parent b088843 commit 2f3edaa

File tree

10 files changed

+85
-70
lines changed

10 files changed

+85
-70
lines changed

apps/browser/src/auth/popup/account-switching/services/account-switcher.service.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ describe("AccountSwitcherService", () => {
176176

177177
expect(messagingService.send).toHaveBeenCalledWith("switchAccount", { userId: null });
178178

179-
expect(removeListenerSpy).toBeCalledTimes(1);
179+
expect(removeListenerSpy).toHaveBeenCalledTimes(1);
180180
});
181181

182182
it("initiates an account switch with an account id", async () => {
@@ -198,13 +198,13 @@ describe("AccountSwitcherService", () => {
198198
await selectAccountPromise;
199199

200200
expect(messagingService.send).toHaveBeenCalledWith("switchAccount", { userId: "1" });
201-
expect(messagingService.send).toBeCalledWith(
201+
expect(messagingService.send).toHaveBeenCalledWith(
202202
"switchAccount",
203203
matches((payload) => {
204204
return payload.userId === "1";
205205
}),
206206
);
207-
expect(removeListenerSpy).toBeCalledTimes(1);
207+
expect(removeListenerSpy).toHaveBeenCalledTimes(1);
208208
});
209209
});
210210
});

apps/browser/src/autofill/background/auto-submit-login.background.spec.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,12 @@ describe("AutoSubmitLoginBackground", () => {
130130
url: validAutoSubmitUrl,
131131
tabId: webRequestDetails.tabId,
132132
});
133-
expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith(expect.any(Function), {
134-
url: [{ hostEquals: validAutoSubmitHost }],
135-
});
133+
expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith(
134+
expect.any(Function),
135+
{
136+
url: [{ hostEquals: validAutoSubmitHost }],
137+
},
138+
);
136139
});
137140

138141
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", () => {
145148

146149
triggerWebRequestOnBeforeRequestEvent(webRequestDetails);
147150

148-
expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith(expect.any(Function), {
149-
url: [{ hostEquals: subFrameHost }],
150-
});
151+
expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith(
152+
expect.any(Function),
153+
{
154+
url: [{ hostEquals: subFrameHost }],
155+
},
156+
);
151157
});
152158

153159
describe("injecting the auto-submit login content script", () => {
@@ -182,7 +188,7 @@ describe("AutoSubmitLoginBackground", () => {
182188
triggerWebNavigationOnCompletedEvent(webNavigationDetails);
183189
await flushPromises();
184190

185-
expect(scriptInjectorService.inject).toBeCalledWith({
191+
expect(scriptInjectorService.inject).toHaveBeenCalledWith({
186192
tabId: webRequestDetails.tabId,
187193
injectDetails: {
188194
file: "content/auto-submit-login.js",
@@ -306,7 +312,7 @@ describe("AutoSubmitLoginBackground", () => {
306312

307313
triggerWebRequestOnBeforeRequestEvent(webRequestDetails);
308314

309-
expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith(
315+
expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith(
310316
autoSubmitLoginBackground["handleAutoSubmitHostNavigationCompleted"],
311317
{ url: [{ hostEquals: validAutoSubmitHost }] },
312318
);
@@ -426,9 +432,12 @@ describe("AutoSubmitLoginBackground", () => {
426432
}),
427433
);
428434

429-
expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith(expect.any(Function), {
430-
url: [{ hostEquals: validAutoSubmitHost }],
431-
});
435+
expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith(
436+
expect.any(Function),
437+
{
438+
url: [{ hostEquals: validAutoSubmitHost }],
439+
},
440+
);
432441
});
433442
});
434443

@@ -477,7 +486,7 @@ describe("AutoSubmitLoginBackground", () => {
477486
sendMockExtensionMessage(message, sender);
478487
await flushPromises();
479488

480-
expect(autofillService.doAutoFillOnTab).toBeCalledWith(
489+
expect(autofillService.doAutoFillOnTab).toHaveBeenCalledWith(
481490
[
482491
{
483492
frameId: sender.frameId,

apps/browser/src/autofill/background/overlay.background.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2878,7 +2878,7 @@ describe("OverlayBackground", () => {
28782878
{ command: "closeAutofillInlineMenu", overlayElement: undefined },
28792879
{ frameId: 0 },
28802880
);
2881-
expect(tabSendMessageDataSpy).toBeCalledWith(
2881+
expect(tabSendMessageDataSpy).toHaveBeenCalledWith(
28822882
sender.tab,
28832883
"addToLockedVaultPendingNotifications",
28842884
{

apps/browser/src/autofill/browser/context-menu-clicked-handler.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ describe("ContextMenuClickedHandler", () => {
105105
it("can generate password", async () => {
106106
await sut.run(createData(GENERATE_PASSWORD_ID), { id: 5 } as any);
107107

108-
expect(generatePasswordToClipboard).toBeCalledTimes(1);
108+
expect(generatePasswordToClipboard).toHaveBeenCalledTimes(1);
109109

110-
expect(generatePasswordToClipboard).toBeCalledWith({
110+
expect(generatePasswordToClipboard).toHaveBeenCalledWith({
111111
id: 5,
112112
});
113113
});
@@ -118,9 +118,9 @@ describe("ContextMenuClickedHandler", () => {
118118

119119
await sut.run(createData(`${AUTOFILL_ID}_1`, AUTOFILL_ID), { id: 5 } as any);
120120

121-
expect(autofill).toBeCalledTimes(1);
121+
expect(autofill).toHaveBeenCalledTimes(1);
122122

123-
expect(autofill).toBeCalledWith({ id: 5 }, cipher);
123+
expect(autofill).toHaveBeenCalledWith({ id: 5 }, cipher);
124124
});
125125

126126
it("copies username to clipboard", async () => {
@@ -132,7 +132,7 @@ describe("ContextMenuClickedHandler", () => {
132132
url: "https://test.com",
133133
} as any);
134134

135-
expect(copyToClipboard).toBeCalledTimes(1);
135+
expect(copyToClipboard).toHaveBeenCalledTimes(1);
136136

137137
expect(copyToClipboard).toHaveBeenCalledWith({
138138
text: "TEST_USERNAME",
@@ -149,7 +149,7 @@ describe("ContextMenuClickedHandler", () => {
149149
url: "https://test.com",
150150
} as any);
151151

152-
expect(copyToClipboard).toBeCalledTimes(1);
152+
expect(copyToClipboard).toHaveBeenCalledTimes(1);
153153

154154
expect(copyToClipboard).toHaveBeenCalledWith({
155155
text: "TEST_PASSWORD",

apps/browser/src/autofill/content/autofill-init.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ describe("AutofillInit", () => {
248248
await flushPromises();
249249

250250
expect(autofillInit["collectAutofillContentService"].getPageDetails).toHaveBeenCalled();
251-
expect(sendResponse).toBeCalledWith(pageDetails);
251+
expect(sendResponse).toHaveBeenCalledWith(pageDetails);
252252
expect(chrome.runtime.sendMessage).not.toHaveBeenCalledWith({
253253
command: "collectPageDetailsResponse",
254254
tab: message.tab,

apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.spec.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ describe("AutofillInlineMenuList", () => {
372372

373373
firstFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));
374374

375-
expect((secondFillCipherElement as HTMLElement).focus).toBeCalled();
375+
expect((secondFillCipherElement as HTMLElement).focus).toHaveBeenCalled();
376376
});
377377

378378
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", () => {
386386

387387
lastFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));
388388

389-
expect((firstFillCipherElement as HTMLElement).focus).toBeCalled();
389+
expect((firstFillCipherElement as HTMLElement).focus).toHaveBeenCalled();
390390
});
391391

392392
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", () => {
406406

407407
lastFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));
408408

409-
expect(autofillInlineMenuList["newItemButtonElement"].focus).toBeCalled();
409+
expect(autofillInlineMenuList["newItemButtonElement"].focus).toHaveBeenCalled();
410410
});
411411

412412
it("allows the user to move keyboard focus to the previous cipher element on ArrowUp", () => {
@@ -420,7 +420,7 @@ describe("AutofillInlineMenuList", () => {
420420

421421
secondFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" }));
422422

423-
expect((firstFillCipherElement as HTMLElement).focus).toBeCalled();
423+
expect((firstFillCipherElement as HTMLElement).focus).toHaveBeenCalled();
424424
});
425425

426426
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", () => {
434434

435435
firstFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" }));
436436

437-
expect((lastFillCipherElement as HTMLElement).focus).toBeCalled();
437+
expect((lastFillCipherElement as HTMLElement).focus).toHaveBeenCalled();
438438
});
439439

440440
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", () => {
454454

455455
firstFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" }));
456456

457-
expect(autofillInlineMenuList["newItemButtonElement"].focus).toBeCalled();
457+
expect(autofillInlineMenuList["newItemButtonElement"].focus).toHaveBeenCalled();
458458
});
459459

460460
it("allows the user to move keyboard focus to the view cipher button on ArrowRight", () => {
@@ -466,7 +466,7 @@ describe("AutofillInlineMenuList", () => {
466466

467467
fillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowRight" }));
468468

469-
expect((viewCipherButton as HTMLElement).focus).toBeCalled();
469+
expect((viewCipherButton as HTMLElement).focus).toHaveBeenCalled();
470470
});
471471

472472
it("ignores keyup events that do not include ArrowUp, ArrowDown, or ArrowRight", () => {
@@ -476,7 +476,7 @@ describe("AutofillInlineMenuList", () => {
476476

477477
fillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowLeft" }));
478478

479-
expect((fillCipherElement as HTMLElement).focus).not.toBeCalled();
479+
expect((fillCipherElement as HTMLElement).focus).not.toHaveBeenCalled();
480480
});
481481
});
482482

@@ -506,7 +506,7 @@ describe("AutofillInlineMenuList", () => {
506506

507507
viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowLeft" }));
508508

509-
expect((fillCipherButton as HTMLElement).focus).toBeCalled();
509+
expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled();
510510
});
511511

512512
it("allows the user to move keyboard to the next cipher element on ArrowDown", () => {
@@ -519,7 +519,7 @@ describe("AutofillInlineMenuList", () => {
519519

520520
viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));
521521

522-
expect((secondFillCipherButton as HTMLElement).focus).toBeCalled();
522+
expect((secondFillCipherButton as HTMLElement).focus).toHaveBeenCalled();
523523
});
524524

525525
it("allows the user to move keyboard focus to the previous cipher element on ArrowUp", () => {
@@ -532,7 +532,7 @@ describe("AutofillInlineMenuList", () => {
532532

533533
viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" }));
534534

535-
expect((firstFillCipherButton as HTMLElement).focus).toBeCalled();
535+
expect((firstFillCipherButton as HTMLElement).focus).toHaveBeenCalled();
536536
});
537537

538538
it("ignores keyup events that do not include ArrowUp, ArrowDown, or ArrowRight", () => {
@@ -542,7 +542,7 @@ describe("AutofillInlineMenuList", () => {
542542

543543
viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowRight" }));
544544

545-
expect((viewCipherButton as HTMLElement).focus).not.toBeCalled();
545+
expect((viewCipherButton as HTMLElement).focus).not.toHaveBeenCalled();
546546
});
547547
});
548548

@@ -769,7 +769,7 @@ describe("AutofillInlineMenuList", () => {
769769

770770
viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));
771771

772-
expect((fillCipherButton as HTMLElement).focus).toBeCalled();
772+
expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled();
773773
});
774774

775775
it("skips the passkeys heading when the user presses ArrowDown to focus the first list item", () => {
@@ -781,7 +781,7 @@ describe("AutofillInlineMenuList", () => {
781781

782782
viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));
783783

784-
expect((fillCipherButton as HTMLElement).focus).toBeCalled();
784+
expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled();
785785
});
786786

787787
it("skips the logins heading when the user presses ArrowUp to focus the previous list item", () => {
@@ -793,7 +793,7 @@ describe("AutofillInlineMenuList", () => {
793793

794794
viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" }));
795795

796-
expect((fillCipherButton as HTMLElement).focus).toBeCalled();
796+
expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled();
797797
});
798798
});
799799
});
@@ -875,7 +875,7 @@ describe("AutofillInlineMenuList", () => {
875875
new KeyboardEvent("keyup", { code: "ArrowRight" }),
876876
);
877877

878-
expect((refreshGeneratedPasswordButton as HTMLElement).focus).toBeCalled();
878+
expect((refreshGeneratedPasswordButton as HTMLElement).focus).toHaveBeenCalled();
879879
});
880880
});
881881
});
@@ -945,7 +945,7 @@ describe("AutofillInlineMenuList", () => {
945945
new KeyboardEvent("keyup", { code: "ArrowLeft" }),
946946
);
947947

948-
expect((fillGeneratedPasswordButton as HTMLElement).focus).toBeCalled();
948+
expect((fillGeneratedPasswordButton as HTMLElement).focus).toHaveBeenCalled();
949949
});
950950
});
951951
});
@@ -1163,7 +1163,7 @@ describe("AutofillInlineMenuList", () => {
11631163

11641164
postWindowMessage({ command: "focusAutofillInlineMenuList" });
11651165

1166-
expect((unlockButton as HTMLElement).focus).toBeCalled();
1166+
expect((unlockButton as HTMLElement).focus).toHaveBeenCalled();
11671167
});
11681168

11691169
it("focuses the new item button element if the cipher list is empty", async () => {
@@ -1175,7 +1175,7 @@ describe("AutofillInlineMenuList", () => {
11751175

11761176
postWindowMessage({ command: "focusAutofillInlineMenuList" });
11771177

1178-
expect((newItemButton as HTMLElement).focus).toBeCalled();
1178+
expect((newItemButton as HTMLElement).focus).toHaveBeenCalled();
11791179
});
11801180

11811181
it("focuses the first cipher button element if the cipher list is populated", () => {
@@ -1186,7 +1186,7 @@ describe("AutofillInlineMenuList", () => {
11861186

11871187
postWindowMessage({ command: "focusAutofillInlineMenuList" });
11881188

1189-
expect((firstCipherItem as HTMLElement).focus).toBeCalled();
1189+
expect((firstCipherItem as HTMLElement).focus).toHaveBeenCalled();
11901190
});
11911191
});
11921192

0 commit comments

Comments
 (0)