mirror of
https://github.com/bitwarden/browser
synced 2026-01-28 23:33:27 +00:00
fix test. remove unused service
This commit is contained in:
@@ -9,7 +9,6 @@ import { BehaviorSubject, Observable, Subject, of } from "rxjs";
|
||||
|
||||
import { PremiumUpgradeDialogComponent } from "@bitwarden/angular/billing/components";
|
||||
import { NudgeType, NudgesService } from "@bitwarden/angular/vault";
|
||||
import { VaultProfileService } from "@bitwarden/angular/vault/services/vault-profile.service";
|
||||
import {
|
||||
AutoConfirmExtensionSetupDialogComponent,
|
||||
AutomaticUserConfirmationService,
|
||||
@@ -185,7 +184,7 @@ describe("VaultV2Component", () => {
|
||||
filterVisibilityState$: new BehaviorSubject<any>({}),
|
||||
} as Partial<VaultPopupListFiltersService>;
|
||||
|
||||
const accountActive$ = new BehaviorSubject<FakeAccount | null>({ id: "user-1" });
|
||||
const activeAccount$ = new BehaviorSubject<FakeAccount | null>({ id: "user-1" });
|
||||
|
||||
const cipherSvc = {
|
||||
failedToDecryptCiphers$: jest.fn().mockReturnValue(of([])),
|
||||
@@ -222,12 +221,6 @@ describe("VaultV2Component", () => {
|
||||
hasPremiumFromAnySource$: (_: string) => hasPremiumFromAnySource$,
|
||||
};
|
||||
|
||||
const vaultProfileSvc = {
|
||||
getProfileCreationDate: jest
|
||||
.fn()
|
||||
.mockResolvedValue(new Date(Date.now() - 8 * 24 * 60 * 60 * 1000)), // 8 days ago
|
||||
};
|
||||
|
||||
const configSvc = {
|
||||
getFeatureFlag$: jest.fn().mockImplementation((_flag: string) => of(false)),
|
||||
};
|
||||
@@ -249,16 +242,12 @@ describe("VaultV2Component", () => {
|
||||
{ provide: VaultPopupScrollPositionService, useValue: scrollSvc },
|
||||
{
|
||||
provide: AccountService,
|
||||
useValue: { activeAccount$: accountActive$ },
|
||||
useValue: { activeAccount$ },
|
||||
},
|
||||
{ provide: CipherService, useValue: cipherSvc },
|
||||
{ provide: DialogService, useValue: dialogSvc },
|
||||
{ provide: IntroCarouselService, useValue: introSvc },
|
||||
{ provide: NudgesService, useValue: nudgesSvc },
|
||||
{
|
||||
provide: VaultProfileService,
|
||||
useValue: vaultProfileSvc,
|
||||
},
|
||||
{
|
||||
provide: VaultPopupCopyButtonsService,
|
||||
useValue: { showQuickCopyActions$: new BehaviorSubject<boolean>(false) },
|
||||
@@ -465,7 +454,7 @@ describe("VaultV2Component", () => {
|
||||
it("dismissVaultNudgeSpotlight forwards to NudgesService with active user id", fakeAsync(() => {
|
||||
const spy = jest.spyOn(nudgesSvc, "dismissNudge").mockResolvedValue(undefined);
|
||||
|
||||
accountActive$.next({ id: "user-xyz" });
|
||||
activeAccount$.next({ id: "user-xyz" });
|
||||
|
||||
void component.ngOnInit();
|
||||
tick();
|
||||
@@ -477,6 +466,10 @@ describe("VaultV2Component", () => {
|
||||
}));
|
||||
|
||||
it("accountAgeInDays$ computes integer days since creation", (done) => {
|
||||
activeAccount$.next({
|
||||
id: "user-123",
|
||||
creationDate: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), // 7 days ago
|
||||
} as any);
|
||||
getObs<number | null>(component, "accountAgeInDays$").subscribe((days) => {
|
||||
if (days !== null) {
|
||||
expect(days).toBeGreaterThanOrEqual(7);
|
||||
@@ -562,10 +555,6 @@ describe("VaultV2Component", () => {
|
||||
itemsSvc.cipherCount$.next(10);
|
||||
hasPremiumFromAnySource$.next(false);
|
||||
|
||||
vaultProfileSvc.getProfileCreationDate = jest
|
||||
.fn()
|
||||
.mockResolvedValue(new Date(Date.now() - 3 * 24 * 60 * 60 * 1000)); // 3 days ago
|
||||
|
||||
(nudgesSvc.showNudgeSpotlight$ as jest.Mock).mockImplementation((type: NudgeType) => {
|
||||
return of(type === NudgeType.PremiumUpgrade);
|
||||
});
|
||||
|
||||
@@ -23,7 +23,6 @@ import { PremiumUpgradeDialogComponent } from "@bitwarden/angular/billing/compon
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { NudgesService, NudgeType } from "@bitwarden/angular/vault";
|
||||
import { SpotlightComponent } from "@bitwarden/angular/vault/components/spotlight/spotlight.component";
|
||||
import { VaultProfileService } from "@bitwarden/angular/vault/services/vault-profile.service";
|
||||
import { DeactivatedOrg, NoResults, VaultOpen } from "@bitwarden/assets/svg";
|
||||
import {
|
||||
AutoConfirmExtensionSetupDialogComponent,
|
||||
@@ -272,7 +271,6 @@ export class VaultV2Component implements OnInit, AfterViewInit, OnDestroy {
|
||||
private router: Router,
|
||||
private autoConfirmService: AutomaticUserConfirmationService,
|
||||
private toastService: ToastService,
|
||||
private vaultProfileService: VaultProfileService,
|
||||
private billingAccountService: BillingAccountProfileStateService,
|
||||
private liveAnnouncer: LiveAnnouncer,
|
||||
private i18nService: I18nService,
|
||||
|
||||
Reference in New Issue
Block a user