mirror of
https://github.com/bitwarden/browser
synced 2026-01-01 08:03:20 +00:00
[PM-16917] Remove jest-extended dependency (#12798)
* add toContainPartialObjects matcher (replacing toIncludeAllPartialMembers from jest-extended) * replace jest-extended matchers with equivalent default matchers
This commit is contained in:
@@ -1,16 +1,12 @@
|
||||
import * as matchers from "jest-extended";
|
||||
|
||||
import { toBeFulfilled, toBeResolved, toBeRejected } from "./promise-fulfilled";
|
||||
import { toAlmostEqual } from "./to-almost-equal";
|
||||
import { toContainPartialObjects } from "./to-contain-partial-objects";
|
||||
import { toEqualBuffer } from "./to-equal-buffer";
|
||||
|
||||
export * from "./to-equal-buffer";
|
||||
export * from "./to-almost-equal";
|
||||
export * from "./promise-fulfilled";
|
||||
|
||||
// add all jest-extended matchers
|
||||
expect.extend(matchers);
|
||||
|
||||
export function addCustomMatchers() {
|
||||
expect.extend({
|
||||
toEqualBuffer: toEqualBuffer,
|
||||
@@ -18,6 +14,7 @@ export function addCustomMatchers() {
|
||||
toBeFulfilled: toBeFulfilled,
|
||||
toBeResolved: toBeResolved,
|
||||
toBeRejected: toBeRejected,
|
||||
toContainPartialObjects,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,4 +56,9 @@ export interface CustomMatchers<R = unknown> {
|
||||
* @returns CustomMatcherResult indicating whether or not the test passed
|
||||
*/
|
||||
toBeRejected(withinMs?: number): Promise<R>;
|
||||
/**
|
||||
* Matches if the received array contains all the expected objects using partial matching (expect.objectContaining).
|
||||
* @param expected An array of partial objects that should be contained in the received array.
|
||||
*/
|
||||
toContainPartialObjects<T>(expected: Array<T>): R;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user