From db5cccb113f5d2806478eb44420285bfc34778bc Mon Sep 17 00:00:00 2001 From: Todd Martin Date: Sat, 22 Nov 2025 19:34:59 -0500 Subject: [PATCH] Added missing tests and missing userInitiated instance. --- .../login-decryption-options.component.ts | 2 +- .../services/logout/default-logout.service.spec.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libs/auth/src/angular/login-decryption-options/login-decryption-options.component.ts b/libs/auth/src/angular/login-decryption-options/login-decryption-options.component.ts index 8b91ade1f04..8499f60a02c 100644 --- a/libs/auth/src/angular/login-decryption-options/login-decryption-options.component.ts +++ b/libs/auth/src/angular/login-decryption-options/login-decryption-options.component.ts @@ -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(["/"]); } diff --git a/libs/auth/src/common/services/logout/default-logout.service.spec.ts b/libs/auth/src/common/services/logout/default-logout.service.spec.ts index b978c65c56b..6585622c72d 100644 --- a/libs/auth/src/common/services/logout/default-logout.service.spec.ts +++ b/libs/auth/src/common/services/logout/default-logout.service.spec.ts @@ -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, + ); + }); }); });