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:
@@ -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(["/"]);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user