1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-24 16:43:27 +00:00

Add matchers for Observable emissions

This commit is contained in:
Matt Gibson
2023-09-28 14:47:02 -04:00
committed by Justin Baur
parent 0425b03ba1
commit 3d2cfa952f
4 changed files with 126 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
import { webcrypto } from "crypto";
import { toEqualBuffer } from "./spec";
import { toEmit, toEmitValue, toEqualBuffer } from "./spec";
Object.defineProperty(window, "crypto", {
value: webcrypto,
@@ -10,8 +10,16 @@ Object.defineProperty(window, "crypto", {
expect.extend({
toEqualBuffer: toEqualBuffer,
toEmit: toEmit,
toEmitValue: toEmitValue,
});
export interface CustomMatchers<R = unknown> {
toEqualBuffer(expected: Uint8Array | ArrayBuffer): R;
toEmit(timeoutMs?: number): R;
toEmitValue(
expected: unknown,
comparer?: (a: unknown, b: unknown) => boolean,
timeoutMs?: number
): R;
}