From 09e29e4e5af549a22115e6ba77c284627c636d03 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Wed, 26 Jun 2024 08:16:19 -0500 Subject: [PATCH] [PM-5189] Adding some documentation and adjust jest test for util method --- apps/browser/src/autofill/utils/index.spec.ts | 4 +--- apps/browser/src/autofill/utils/index.ts | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/browser/src/autofill/utils/index.spec.ts b/apps/browser/src/autofill/utils/index.spec.ts index b33ccbffddb..116df044b37 100644 --- a/apps/browser/src/autofill/utils/index.spec.ts +++ b/apps/browser/src/autofill/utils/index.spec.ts @@ -38,9 +38,7 @@ describe("generateRandomCustomElementName", () => { describe("sendExtensionMessage", () => { it("sends a message to the extension", async () => { - const extensionMessagePromise = sendExtensionMessage("toggleAutofillInlineMenuHidden", { - display: "none", - }); + const extensionMessagePromise = sendExtensionMessage("some-extension-message"); // Jest doesn't give anyway to select the typed overload of "sendMessage", // a cast is needed to get the correct spy type. diff --git a/apps/browser/src/autofill/utils/index.ts b/apps/browser/src/autofill/utils/index.ts index 08ce1314b5f..a040fa50122 100644 --- a/apps/browser/src/autofill/utils/index.ts +++ b/apps/browser/src/autofill/utils/index.ts @@ -1,6 +1,11 @@ import { AutofillPort } from "../enums/autofill-port.enum"; import { FillableFormFieldElement, FormElementWithAttribute, FormFieldElement } from "../types"; +/** + * Generates a random string of characters. + * + * @param length - The length of the random string to generate. + */ export function generateRandomChars(length: number): string { const chars = "abcdefghijklmnopqrstuvwxyz"; const randomChars = [];