From 9e8309a255132429004ef5b1d6bdbed812fe26d2 Mon Sep 17 00:00:00 2001 From: Prithpal Sooriya Date: Mon, 2 Dec 2024 17:46:14 +0000 Subject: [PATCH] fix: ensure sign-out does not error, and can safely sign out without issues --- .../authentication/AuthenticationController.test.ts | 12 ------------ .../authentication/AuthenticationController.ts | 2 -- 2 files changed, 14 deletions(-) diff --git a/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.test.ts b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.test.ts index 880a42f0f9f..1f72778d55d 100644 --- a/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.test.ts +++ b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.test.ts @@ -156,18 +156,6 @@ describe('authentication/authentication-controller - performSignOut() tests', () expect(controller.state.isSignedIn).toBe(false); expect(controller.state.sessionData).toBeUndefined(); }); - - it('should throw error if attempting to sign out when user is not logged in', () => { - const metametrics = createMockAuthMetaMetrics(); - const { messenger } = createMockAuthenticationMessenger(); - const controller = new AuthenticationController({ - messenger, - state: { isSignedIn: false }, - metametrics, - }); - - expect(() => controller.performSignOut()).toThrow(expect.any(Error)); - }); }); describe('authentication/authentication-controller - getBearerToken() tests', () => { diff --git a/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts index 2d518c5f1fd..4b9494ee1ac 100644 --- a/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts +++ b/packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.ts @@ -222,8 +222,6 @@ export default class AuthenticationController extends BaseController< } public performSignOut(): void { - this.#assertLoggedIn(); - this.update((state) => { state.isSignedIn = false; state.sessionData = undefined;