mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-21 16:18:28 +01:00
init observable on service (#8577)
This commit is contained in:
parent
af5f45443d
commit
2e6d977ef1
@ -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({
|
||||
|
@ -22,7 +22,9 @@ export class AuthRequestService implements AuthRequestServiceAbstraction {
|
||||
private cryptoService: CryptoService,
|
||||
private apiService: ApiService,
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
) {
|
||||
this.authRequestPushNotification$ = this.authRequestPushNotificationSubject.asObservable();
|
||||
}
|
||||
|
||||
async approveOrDenyAuthRequest(
|
||||
approve: boolean,
|
||||
|
Loading…
Reference in New Issue
Block a user