From cb4051f7041573cdb0e7774a5a1dceb36f12afad Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Tue, 30 Apr 2024 10:38:09 -0500 Subject: [PATCH] [PM-6426] Fixing generate password to clipboard command jest tests --- .../generate-password-to-clipboard-command.spec.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/browser/src/autofill/clipboard/generate-password-to-clipboard-command.spec.ts b/apps/browser/src/autofill/clipboard/generate-password-to-clipboard-command.spec.ts index b64f5da561..e74292563e 100644 --- a/apps/browser/src/autofill/clipboard/generate-password-to-clipboard-command.spec.ts +++ b/apps/browser/src/autofill/clipboard/generate-password-to-clipboard-command.spec.ts @@ -26,7 +26,13 @@ describe("GeneratePasswordToClipboardCommand", () => { passwordGenerationService = mock(); autofillSettingsService = mock(); browserTaskSchedulerService = mock({ - setTimeout: jest.fn(async (callback, timeoutInMs) => setTimeout(callback, timeoutInMs)), + setTimeout: jest.fn(async (taskName, timeoutInMs) => + setTimeout(() => { + if (taskName === ScheduledTaskNames.generatePasswordClearClipboardTimeout) { + void ClearClipboard.run(); + } + }, timeoutInMs), + ), }); passwordGenerationService.getOptions.mockResolvedValue([{ length: 8 }, {} as any]);