[PM-6426] Fixing generate password to clipboard command jest tests

This commit is contained in:
Cesar Gonzalez 2024-04-30 10:38:09 -05:00
parent 86d273df46
commit cb4051f704
No known key found for this signature in database
GPG Key ID: 3381A5457F8CCECF
1 changed files with 7 additions and 1 deletions

View File

@ -26,7 +26,13 @@ describe("GeneratePasswordToClipboardCommand", () => {
passwordGenerationService = mock<PasswordGenerationServiceAbstraction>();
autofillSettingsService = mock<AutofillSettingsService>();
browserTaskSchedulerService = mock<BrowserTaskSchedulerService>({
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]);