1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-30 03:41:51 +01:00
bitwarden-estensione-browser/libs/common/test.setup.ts

28 lines
572 B
TypeScript
Raw Normal View History

import { webcrypto } from "crypto";
import { toEqualBuffer } from "./spec";
Object.defineProperty(window, "crypto", {
value: webcrypto,
});
// 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 */