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

[PM-7169][PM-5267] Remove auth status from account info (#8539)

* remove active account unlocked from state service

* Remove status from account service `AccountInfo`

* Fixup lingering usages of status

Fixup missed factories

* Fixup account info usage

* fixup CLI build

* Fixup current account type

* Add helper for all auth statuses to auth service

* Fix tests

* Uncomment mistakenly commented code

* Rework logged out account exclusion tests

* Correct test description

* Avoid getters returning observables

* fixup type
This commit is contained in:
Matt Gibson
2024-04-12 02:25:45 -05:00
committed by GitHub
parent c7ea35280d
commit 8d698d9d84
31 changed files with 200 additions and 304 deletions

View File

@@ -1,8 +1,7 @@
import { mock } from "jest-mock-extended";
import { Observable, ReplaySubject } from "rxjs";
import { ReplaySubject } from "rxjs";
import { AccountInfo, AccountService } from "../src/auth/abstractions/account.service";
import { AuthenticationStatus } from "../src/auth/enums/authentication-status";
import { UserId } from "../src/types/guid";
export function mockAccountServiceWith(
@@ -14,7 +13,6 @@ export function mockAccountServiceWith(
...{
name: "name",
email: "email",
status: AuthenticationStatus.Locked,
},
};
const service = new FakeAccountService({ [userId]: fullInfo });
@@ -34,8 +32,6 @@ export class FakeAccountService implements AccountService {
}
accounts$ = this.accountsSubject.asObservable();
activeAccount$ = this.activeAccountSubject.asObservable();
accountLock$: Observable<UserId>;
accountLogout$: Observable<UserId>;
constructor(initialData: Record<UserId, AccountInfo>) {
this.accountsSubject.next(initialData);
@@ -57,14 +53,6 @@ export class FakeAccountService implements AccountService {
await this.mock.setAccountEmail(userId, email);
}
async setAccountStatus(userId: UserId, status: AuthenticationStatus): Promise<void> {
await this.mock.setAccountStatus(userId, status);
}
async setMaxAccountStatus(userId: UserId, maxStatus: AuthenticationStatus): Promise<void> {
await this.mock.setMaxAccountStatus(userId, maxStatus);
}
async switchAccount(userId: UserId): Promise<void> {
const next =
userId == null ? null : { id: userId, ...this.accountsSubject["_buffer"]?.[0]?.[userId] };