2022-03-28 16:00:42 +02:00
|
|
|
import { webcrypto } from "crypto";
|
|
|
|
|
2023-05-09 11:27:09 +02:00
|
|
|
import { toEqualBuffer } from "./spec";
|
2022-07-26 03:40:32 +02:00
|
|
|
|
2022-03-28 16:00:42 +02:00
|
|
|
Object.defineProperty(window, "crypto", {
|
|
|
|
value: webcrypto,
|
|
|
|
});
|
2022-07-26 03:40:32 +02:00
|
|
|
|
|
|
|
// Add custom matchers
|
|
|
|
|
|
|
|
expect.extend({
|
|
|
|
toEqualBuffer: toEqualBuffer,
|
|
|
|
});
|
|
|
|
|
|
|
|
interface CustomMatchers<R = unknown> {
|
|
|
|
toEqualBuffer(expected: Uint8Array | ArrayBuffer): R;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* eslint-disable */
|
|
|
|
declare global {
|
|
|
|
namespace jest {
|
|
|
|
interface Expect extends CustomMatchers {}
|
|
|
|
interface Matchers<R> extends CustomMatchers<R> {}
|
|
|
|
interface InverseAsymmetricMatchers extends CustomMatchers {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* eslint-enable */
|