1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +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,77 @@
describe("toContainPartialObjects", () => {
describe("matches", () => {
it("if the array only contains the partial objects", () => {
const actual = [
{
id: 1,
name: "foo",
},
{
id: 2,
name: "bar",
},
];
const expected = [{ id: 1 }, { id: 2 }];
expect(actual).toContainPartialObjects(expected);
});
it("if the array contains the partial objects and other objects", () => {
const actual = [
{
id: 1,
name: "foo",
},
{
id: 2,
name: "bar",
},
{
id: 3,
name: "baz",
},
];
const expected = [{ id: 1 }, { id: 2 }];
expect(actual).toContainPartialObjects(expected);
});
});
describe("doesn't match", () => {
it("if the array does not contain any partial objects", () => {
const actual = [
{
id: 1,
name: "foo",
},
{
id: 2,
name: "bar",
},
];
const expected = [{ id: 1, name: "Foo" }];
expect(actual).not.toContainPartialObjects(expected);
});
it("if the array contains some but not all partial objects", () => {
const actual = [
{
id: 1,
name: "foo",
},
{
id: 2,
name: "bar",
},
];
const expected = [{ id: 2 }, { id: 3 }];
expect(actual).not.toContainPartialObjects(expected);
});
});
});