1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-05 11:13:44 +00:00

test(browser-approval): [PM-23620] Auth Request Answering Service - Fixed some bugs with the tests.

This commit is contained in:
Patrick Pimentel
2025-08-20 17:30:14 -04:00
parent 34e2260c4e
commit abe0db76b0
2 changed files with 10 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
import { SystemNotificationEvent } from "@bitwarden/common/platform/notifications/system-notifications-service";
import { SystemNotificationEvent } from "@bitwarden/common/platform/system-notifications/system-notifications.service";
import { UserId } from "@bitwarden/user-core";
import { AuthRequestAnsweringServiceAbstraction } from "../../abstractions/auth-request-answering/auth-request-answering.service.abstraction";

View File

@@ -4,7 +4,8 @@ import { BehaviorSubject, bufferCount, firstValueFrom, ObservedValueOf, Subject
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { LogoutReason } from "@bitwarden/auth/common";
import { SystemNotificationsService } from "@bitwarden/common/platform/notifications/system-notifications-service";
import { AuthRequestAnsweringServiceAbstraction } from "@bitwarden/common/auth/abstractions/auth-request-answering/auth-request-answering.service.abstraction";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { awaitAsync } from "../../../../spec";
import { Matrix } from "../../../../spec/matrix";
@@ -39,7 +40,8 @@ describe("NotificationsService", () => {
let signalRNotificationConnectionService: MockProxy<SignalRConnectionService>;
let authService: MockProxy<AuthService>;
let webPushNotificationConnectionService: MockProxy<WebPushConnectionService>;
let systemNotificationService: MockProxy<SystemNotificationsService>;
let authRequestAnsweringService: MockProxy<AuthRequestAnsweringServiceAbstraction>;
let configService: MockProxy<ConfigService>;
let activeAccount: BehaviorSubject<ObservedValueOf<AccountService["activeAccount$"]>>;
@@ -66,6 +68,8 @@ describe("NotificationsService", () => {
signalRNotificationConnectionService = mock<SignalRConnectionService>();
authService = mock<AuthService>();
webPushNotificationConnectionService = mock<WorkerWebPushConnectionService>();
authRequestAnsweringService = mock<AuthRequestAnsweringServiceAbstraction>();
configService = mock<ConfigService>();
activeAccount = new BehaviorSubject<ObservedValueOf<AccountService["activeAccount$"]>>(null);
accountService.activeAccount$ = activeAccount.asObservable();
@@ -106,14 +110,15 @@ describe("NotificationsService", () => {
signalRNotificationConnectionService,
authService,
webPushNotificationConnectionService,
systemNotificationService,
authRequestAnsweringService,
configService,
);
});
const mockUser1 = "user1" as UserId;
const mockUser2 = "user2" as UserId;
function emitActiveUser(userId: UserId) {
function emitActiveUser(userId: UserId | null) {
if (userId == null) {
activeAccount.next(null);
} else {