1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-28 14:13:22 +00:00

Added helper method to abstract account initialization in tests.

This commit is contained in:
Todd Martin
2025-12-09 18:17:13 -05:00
parent 57631fb0ce
commit 9bcae12b95
14 changed files with 94 additions and 129 deletions

View File

@@ -2,14 +2,18 @@ import { TestBed } from "@angular/core/testing";
import { BehaviorSubject, firstValueFrom, take, timeout } from "rxjs";
import { AuthRequestServiceAbstraction } from "@bitwarden/auth/common";
import { AccountInfo, AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { AuthRequestResponse } from "@bitwarden/common/auth/models/response/auth-request.response";
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
import { DeviceType } from "@bitwarden/common/enums";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { StateProvider } from "@bitwarden/common/platform/state";
import { FakeStateProvider, mockAccountServiceWith } from "@bitwarden/common/spec";
import {
FakeStateProvider,
mockAccountServiceWith,
mockAccountInfoWith,
} from "@bitwarden/common/spec";
import { UserId } from "@bitwarden/common/types/guid";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
@@ -27,13 +31,11 @@ describe("VaultBannersService", () => {
const fakeStateProvider = new FakeStateProvider(mockAccountServiceWith(userId));
const getEmailVerified = jest.fn().mockResolvedValue(true);
const lastSync$ = new BehaviorSubject<Date | null>(null);
const accounts$ = new BehaviorSubject<Record<UserId, AccountInfo>>({
[userId]: {
const accounts$ = new BehaviorSubject({
[userId]: mockAccountInfoWith({
email: "test@bitwarden.com",
emailVerified: true,
name: "name",
creationDate: "2024-01-01T00:00:00.000Z",
} as AccountInfo,
}),
});
const pendingAuthRequests$ = new BehaviorSubject<Array<AuthRequestResponse>>([]);