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 eaf986ac4a3..7b85ede78d5 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 @@ -2,7 +2,7 @@ import { Component } from "@angular/core"; import { ComponentFixture, TestBed } from "@angular/core/testing"; import { ActivatedRoute, Router, convertToParamMap } from "@angular/router"; import { mock, MockProxy } from "jest-mock-extended"; -import { BehaviorSubject, of } from "rxjs"; +import { BehaviorSubject } from "rxjs"; import { WINDOW } from "@bitwarden/angular/services/injection-tokens"; import { @@ -34,9 +34,9 @@ import { FakeAccountService, mockAccountServiceWith } from "@bitwarden/common/sp import { UserId } from "@bitwarden/common/types/guid"; import { DialogService, ToastService } from "@bitwarden/components"; +import { DefaultTwoFactorFormCacheService } from "../../common/services/auth-request/default-two-factor-form-cache.service"; import { AnonLayoutWrapperDataService } from "../anon-layout/anon-layout-wrapper-data.service"; -import { TwoFactorFormCacheService } from "./abstractions/two-factor-form-cache.service.abstraction"; import { TwoFactorAuthComponentService } from "./two-factor-auth-component.service"; import { TwoFactorAuthComponent } from "./two-factor-auth.component"; @@ -71,7 +71,7 @@ describe("TwoFactorAuthComponent", () => { let anonLayoutWrapperDataService: MockProxy; let mockEnvService: MockProxy; let mockLoginSuccessHandlerService: MockProxy; - let mockTwoFactorFormCacheService: MockProxy; + let mockTwoFactorFormCacheService: MockProxy; let mockUserDecryptionOpts: { noMasterPassword: UserDecryptionOptions; @@ -112,9 +112,9 @@ describe("TwoFactorAuthComponent", () => { anonLayoutWrapperDataService = mock(); - mockTwoFactorFormCacheService = mock(); - mockTwoFactorFormCacheService.isEnabled$.mockReturnValue(of(false)); - mockTwoFactorFormCacheService.formData$.mockReturnValue(of(null)); + mockTwoFactorFormCacheService = mock(); + mockTwoFactorFormCacheService.getCachedTwoFactorFormData.mockReturnValue(null); + mockTwoFactorFormCacheService.init.mockResolvedValue(); mockUserDecryptionOpts = { noMasterPassword: new UserDecryptionOptions({ @@ -159,7 +159,9 @@ describe("TwoFactorAuthComponent", () => { }), }; - selectedUserDecryptionOptions = new BehaviorSubject(undefined); + selectedUserDecryptionOptions = new BehaviorSubject( + mockUserDecryptionOpts.withMasterPassword, + ); mockUserDecryptionOptionsService.userDecryptionOptions$ = selectedUserDecryptionOptions; TestBed.configureTestingModule({ @@ -198,7 +200,7 @@ describe("TwoFactorAuthComponent", () => { { provide: EnvironmentService, useValue: mockEnvService }, { provide: AnonLayoutWrapperDataService, useValue: anonLayoutWrapperDataService }, { provide: LoginSuccessHandlerService, useValue: mockLoginSuccessHandlerService }, - { provide: TwoFactorFormCacheService, useValue: mockTwoFactorFormCacheService }, + { provide: DefaultTwoFactorFormCacheService, useValue: mockTwoFactorFormCacheService }, ], });