1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 18:23:31 +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:
Thomas Rittson
2025-01-16 01:43:26 +10:00
committed by GitHub
parent bdab4aa939
commit 8c13ea894b
15 changed files with 146 additions and 54 deletions

View File

@@ -0,0 +1,31 @@
import { EOL } from "os";
import { diff } from "jest-diff";
export const toContainPartialObjects: jest.CustomMatcher = function (
received: Array<any>,
expected: Array<any>,
) {
const matched = this.equals(
received,
expect.arrayContaining(expected.map((e) => expect.objectContaining(e))),
);
if (matched) {
return {
message: () =>
"Expected the received array NOT to include partial matches for all expected objects." +
EOL +
diff(expected, received),
pass: true,
};
}
return {
message: () =>
"Expected the received array to contain partial matches for all expected objects." +
EOL +
diff(expected, received),
pass: false,
};
};