1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

Merge branch 'main' into autofill/pm-8518-autofill-scripts-do-not-inject-into-sub-frames-on-install

This commit is contained in:
Cesar Gonzalez
2024-05-31 16:15:35 -05:00
committed by GitHub
11 changed files with 46 additions and 48 deletions

View File

@@ -144,7 +144,7 @@ describe("AutofillInit", () => {
.mockResolvedValue(pageDetails);
const response = await autofillInit["handleExtensionMessage"](message, sender, sendResponse);
await Promise.resolve(response);
await flushPromises();
expect(response).toBe(true);
expect(sendResponse).toHaveBeenCalledWith(pageDetails);

View File

@@ -37,14 +37,29 @@ describe("generateRandomCustomElementName", () => {
});
describe("sendExtensionMessage", () => {
it("sends a message to the extention", () => {
const extensionMessageResponse = sendExtensionMessage("updateAutofillOverlayHidden", {
it("sends a message to the extension", async () => {
const extensionMessagePromise = sendExtensionMessage("updateAutofillOverlayHidden", {
display: "none",
});
jest.spyOn(chrome.runtime, "sendMessage");
expect(chrome.runtime.sendMessage).toHaveBeenCalled();
expect(extensionMessageResponse).toEqual(Promise.resolve({}));
// Jest doesn't give anyway to select the typed overload of "sendMessage",
// a cast is needed to get the correct spy type.
const sendMessageSpy = jest.spyOn(chrome.runtime, "sendMessage") as unknown as jest.SpyInstance<
void,
[message: string, responseCallback: (response: string) => void],
unknown
>;
expect(sendMessageSpy).toHaveBeenCalled();
const [latestCall] = sendMessageSpy.mock.calls;
const responseCallback = latestCall[1];
responseCallback("sendMessageResponse");
const response = await extensionMessagePromise;
expect(response).toEqual("sendMessageResponse");
});
});

View File

@@ -53,7 +53,9 @@ describe("Fido2 page script with native WebAuthn support", () => {
const mockCredentialAssertResult = createAssertCredentialResultMock();
setupMockedWebAuthnSupport();
require("./page-script");
beforeAll(() => {
require("./page-script");
});
afterEach(() => {
jest.resetModules();

View File

@@ -1,3 +1,5 @@
import "jest-preset-angular/setup-jest";
// Add chrome storage api
const QUOTA_BYTES = 10;
const storage = {

View File

@@ -1,7 +1,7 @@
{
"name": "@bitwarden/desktop",
"description": "A secure and free password manager for all of your devices.",
"version": "2024.5.0",
"version": "2024.5.1",
"keywords": [
"bitwarden",
"password",

View File

@@ -1,12 +1,12 @@
{
"name": "@bitwarden/desktop",
"version": "2024.5.0",
"version": "2024.5.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@bitwarden/desktop",
"version": "2024.5.0",
"version": "2024.5.1",
"license": "GPL-3.0",
"dependencies": {
"@bitwarden/desktop-native": "file:../desktop_native",

View File

@@ -2,7 +2,7 @@
"name": "@bitwarden/desktop",
"productName": "Bitwarden",
"description": "A secure and free password manager for all of your devices.",
"version": "2024.5.0",
"version": "2024.5.1",
"author": "Bitwarden Inc. <hello@bitwarden.com> (https://bitwarden.com)",
"homepage": "https://bitwarden.com",
"license": "GPL-3.0",