[PM-6426] Adjusting name for generate password to clipboard command task name

This commit is contained in:
Cesar Gonzalez 2024-04-23 13:01:49 -05:00
parent edf296be46
commit 92a77cf957
No known key found for this signature in database
GPG Key ID: 3381A5457F8CCECF
3 changed files with 9 additions and 10 deletions

View File

@ -62,9 +62,8 @@ describe("GeneratePasswordToClipboardCommand", () => {
}); });
expect(browserTaskSchedulerService.setTimeout).toHaveBeenCalledTimes(1); expect(browserTaskSchedulerService.setTimeout).toHaveBeenCalledTimes(1);
expect(browserTaskSchedulerService.setTimeout).toHaveBeenCalledWith( expect(browserTaskSchedulerService.setTimeout).toHaveBeenCalledWith(
expect.any(Function), ScheduledTaskNames.generatePasswordClearClipboardTimeout,
expect.any(Number), expect.any(Number),
ScheduledTaskNames.clearClipboardTimeout,
); );
expect(ClearClipboard.run).toHaveBeenCalledTimes(1); expect(ClearClipboard.run).toHaveBeenCalledTimes(1);
}); });

View File

@ -15,10 +15,10 @@ export class GeneratePasswordToClipboardCommand {
constructor( constructor(
private passwordGenerationService: PasswordGenerationServiceAbstraction, private passwordGenerationService: PasswordGenerationServiceAbstraction,
private autofillSettingsService: AutofillSettingsServiceAbstraction, private autofillSettingsService: AutofillSettingsServiceAbstraction,
private taskSchedulerService: BrowserTaskSchedulerService, private taskSchedulerService?: BrowserTaskSchedulerService,
) { ) {
void this.taskSchedulerService.registerTaskHandler( void this.taskSchedulerService?.registerTaskHandler(
ScheduledTaskNames.clearClipboardTimeout, ScheduledTaskNames.generatePasswordClearClipboardTimeout,
() => ClearClipboard.run(), () => ClearClipboard.run(),
); );
} }
@ -39,12 +39,12 @@ export class GeneratePasswordToClipboardCommand {
} }
const timeoutInMs = clearClipboardDelayInSeconds * 1000; const timeoutInMs = clearClipboardDelayInSeconds * 1000;
await this.taskSchedulerService.clearScheduledTask({ await this.taskSchedulerService?.clearScheduledTask({
taskName: ScheduledTaskNames.clearClipboardTimeout, taskName: ScheduledTaskNames.generatePasswordClearClipboardTimeout,
timeoutId: this.clearClipboardTimeout, timeoutId: this.clearClipboardTimeout,
}); });
await this.taskSchedulerService.setTimeout( await this.taskSchedulerService?.setTimeout(
ScheduledTaskNames.clearClipboardTimeout, ScheduledTaskNames.generatePasswordClearClipboardTimeout,
timeoutInMs, timeoutInMs,
); );
} }

View File

@ -1,5 +1,5 @@
export const ScheduledTaskNames = { export const ScheduledTaskNames = {
clearClipboardTimeout: "clearClipboardTimeout", generatePasswordClearClipboardTimeout: "generatePasswordClearClipboardTimeout",
systemClearClipboardTimeout: "systemClearClipboardTimeout", systemClearClipboardTimeout: "systemClearClipboardTimeout",
loginStrategySessionTimeout: "loginStrategySessionTimeout", loginStrategySessionTimeout: "loginStrategySessionTimeout",
notificationsReconnectTimeout: "notificationsReconnectTimeout", notificationsReconnectTimeout: "notificationsReconnectTimeout",