mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
init observable on service (#8577)
This commit is contained in:
@@ -2,6 +2,7 @@ import { mock } from "jest-mock-extended";
|
||||
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { AuthRequestResponse } from "@bitwarden/common/auth/models/response/auth-request.response";
|
||||
import { AuthRequestPushNotification } from "@bitwarden/common/models/response/notification.response";
|
||||
import { AppIdService } from "@bitwarden/common/platform/abstractions/app-id.service";
|
||||
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||
@@ -30,6 +31,22 @@ describe("AuthRequestService", () => {
|
||||
mockPrivateKey = new Uint8Array(64);
|
||||
});
|
||||
|
||||
describe("authRequestPushNotification$", () => {
|
||||
it("should emit when sendAuthRequestPushNotification is called", () => {
|
||||
const notification = {
|
||||
id: "PUSH_NOTIFICATION",
|
||||
userId: "USER_ID",
|
||||
} as AuthRequestPushNotification;
|
||||
|
||||
const spy = jest.fn();
|
||||
sut.authRequestPushNotification$.subscribe(spy);
|
||||
|
||||
sut.sendAuthRequestPushNotification(notification);
|
||||
|
||||
expect(spy).toHaveBeenCalledWith("PUSH_NOTIFICATION");
|
||||
});
|
||||
});
|
||||
|
||||
describe("approveOrDenyAuthRequest", () => {
|
||||
beforeEach(() => {
|
||||
cryptoService.rsaEncrypt.mockResolvedValue({
|
||||
|
||||
Reference in New Issue
Block a user