From 7b1e4220dda9478f35075c9707aef59af8568db7 Mon Sep 17 00:00:00 2001 From: Alec Rippberger Date: Mon, 10 Mar 2025 11:25:23 -0500 Subject: [PATCH] Fix tests --- .../src/auth/components/two-factor-v1.component.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/angular/src/auth/components/two-factor-v1.component.spec.ts b/libs/angular/src/auth/components/two-factor-v1.component.spec.ts index ccbd8e18a6c..449b0c29986 100644 --- a/libs/angular/src/auth/components/two-factor-v1.component.spec.ts +++ b/libs/angular/src/auth/components/two-factor-v1.component.spec.ts @@ -5,6 +5,7 @@ import { mock, MockProxy } from "jest-mock-extended"; import { BehaviorSubject } from "rxjs"; import { WINDOW } from "@bitwarden/angular/services/injection-tokens"; +import { TwoFactorFormCacheService } from "@bitwarden/auth/angular"; import { LoginStrategyServiceAbstraction, LoginEmailServiceAbstraction, @@ -72,6 +73,7 @@ describe("TwoFactorComponent", () => { let mockMasterPasswordService: FakeMasterPasswordService; let mockAccountService: FakeAccountService; let mockToastService: MockProxy; + let mockTwoFactorFormCacheService: MockProxy; let mockUserDecryptionOpts: { noMasterPassword: UserDecryptionOptions; @@ -108,6 +110,11 @@ describe("TwoFactorComponent", () => { mockAccountService = mockAccountServiceWith(userId); mockToastService = mock(); mockMasterPasswordService = new FakeMasterPasswordService(); + mockTwoFactorFormCacheService = mock(); + + // Setup form cache service mock with necessary observables + mockTwoFactorFormCacheService.isEnabled$.mockReturnValue(new BehaviorSubject(false)); + mockTwoFactorFormCacheService.formData$.mockReturnValue(new BehaviorSubject(null)); mockUserDecryptionOpts = { noMasterPassword: new UserDecryptionOptions({ @@ -190,6 +197,7 @@ describe("TwoFactorComponent", () => { { provide: InternalMasterPasswordServiceAbstraction, useValue: mockMasterPasswordService }, { provide: AccountService, useValue: mockAccountService }, { provide: ToastService, useValue: mockToastService }, + { provide: TwoFactorFormCacheService, useValue: mockTwoFactorFormCacheService }, ], });