From 8506449f9d3785f3923d5672cdb6fb3ac16f673a Mon Sep 17 00:00:00 2001 From: Jared Snider Date: Fri, 24 Jan 2025 16:18:38 -0500 Subject: [PATCH] PM-8113 - TwoFactorAuth - Clean up unused stuff and get tests passing --- .../two-factor-auth/two-factor-auth.component.spec.ts | 11 +++++------ .../two-factor-auth/two-factor-auth.component.ts | 2 -- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.spec.ts b/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.spec.ts index e4c1a16e701..af12c54371d 100644 --- a/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.spec.ts +++ b/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.spec.ts @@ -1,3 +1,5 @@ +// FIXME: Update this file to be type safe and remove this and next line +// @ts-strict-ignore import { Component } from "@angular/core"; import { ComponentFixture, TestBed } from "@angular/core/testing"; import { ActivatedRoute, convertToParamMap, Router } from "@angular/router"; @@ -27,7 +29,6 @@ import { FakeMasterPasswordService } from "@bitwarden/common/auth/services/maste import { AppIdService } from "@bitwarden/common/platform/abstractions/app-id.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { SyncService } from "@bitwarden/common/platform/sync"; @@ -68,7 +69,6 @@ describe("TwoFactorComponent", () => { let mockToastService: MockProxy; let mockTwoFactorAuthCompService: MockProxy; let mockSyncService: MockProxy; - let mockMessagingService: MockProxy; let mockUserDecryptionOpts: { noMasterPassword: UserDecryptionOptions; @@ -103,8 +103,9 @@ describe("TwoFactorComponent", () => { mockDialogService = mock(); mockToastService = mock(); mockTwoFactorAuthCompService = mock(); + mockTwoFactorAuthCompService.handle2faSuccess = undefined; + mockSyncService = mock(); - mockMessagingService = mock(); mockUserDecryptionOpts = { noMasterPassword: new UserDecryptionOptions({ @@ -149,7 +150,7 @@ describe("TwoFactorComponent", () => { }), }; - selectedUserDecryptionOptions = new BehaviorSubject(null); + selectedUserDecryptionOptions = new BehaviorSubject(undefined); mockUserDecryptionOptionsService.userDecryptionOptions$ = selectedUserDecryptionOptions; TestBed.configureTestingModule({ @@ -186,7 +187,6 @@ describe("TwoFactorComponent", () => { { provide: ToastService, useValue: mockToastService }, { provide: TwoFactorAuthComponentService, useValue: mockTwoFactorAuthCompService }, { provide: SyncService, useValue: mockSyncService }, - { provide: MessagingService, useValue: mockMessagingService }, ], }); @@ -260,7 +260,6 @@ describe("TwoFactorComponent", () => { // Assert expect(mockLoginStrategyService.logInTwoFactor).toHaveBeenCalledWith( new TokenTwoFactorRequest(component.selectedProviderType, token, remember), - null, // captcha token not supported ); }); diff --git a/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts b/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts index 8bcb405368e..9a509e8a4fe 100644 --- a/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts +++ b/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts @@ -26,7 +26,6 @@ import { TokenTwoFactorRequest } from "@bitwarden/common/auth/models/request/ide import { TwoFactorProviders } from "@bitwarden/common/auth/services/two-factor.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { SyncService } from "@bitwarden/common/platform/sync"; import { @@ -134,7 +133,6 @@ export class TwoFactorAuthComponent implements OnInit, OnDestroy { private toastService: ToastService, private twoFactorAuthComponentService: TwoFactorAuthComponentService, private syncService: SyncService, - private messagingService: MessagingService, private destroyRef: DestroyRef, ) {}