[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).toHaveBeenCalledWith(
expect.any(Function),
ScheduledTaskNames.generatePasswordClearClipboardTimeout,
expect.any(Number),
ScheduledTaskNames.clearClipboardTimeout,
);
expect(ClearClipboard.run).toHaveBeenCalledTimes(1);
});

View File

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

View File

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