1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-31 08:43:54 +00:00

Added missing tests and missing userInitiated instance.

This commit is contained in:
Todd Martin
2025-11-22 19:34:59 -05:00
parent 36f88c2038
commit db5cccb113
2 changed files with 12 additions and 1 deletions

View File

@@ -313,7 +313,7 @@ export class LoginDecryptionOptionsComponent implements OnInit {
const userId = (await firstValueFrom(this.accountService.activeAccount$))?.id;
if (confirmed) {
await this.logoutService.logout(userId);
await this.logoutService.logout(userId, "userInitiated");
// navigate to root so redirect guard can properly route next active user or null user to correct page
await this.router.navigate(["/"]);
}

View File

@@ -31,5 +31,16 @@ describe("DefaultLogoutService", () => {
await logoutService.logout(userId, logoutReason);
expect(messagingService.send).toHaveBeenCalledWith("logout", { userId, logoutReason });
});
it("logs the logout with userId and reason", async () => {
const userId = "test-user-id" as UserId;
const logoutReason: LogoutReason = "sessionExpired";
await logoutService.logout(userId, logoutReason);
expect(logService.info).toHaveBeenCalledWith(
"Logging out user %s for reason: %s",
userId,
logoutReason,
);
});
});
});