Skip to content

Commit ecb5836

Browse files
eps1loncpojer
authored andcommitted
docs: Expand changelog entry for #5367 (#5719)
1 parent e9aa321 commit ecb5836

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@
215215
malformed source-map. ([#5405](https://github.com/facebook/jest/pull/5405)).
216216
* `[jest]` Add `import-local` to `jest` package.
217217
([#5353](https://github.com/facebook/jest/pull/5353))
218-
* `[expect]` Support class instances in `.toHaveProperty()` matcher.
219-
([#5367](https://github.com/facebook/jest/pull/5367))
218+
* `[expect]` Support class instances in `.toHaveProperty()` and `.toMatchObject`
219+
matcher. ([#5367](https://github.com/facebook/jest/pull/5367))
220220
* `[jest-cli]` Fix npm update command for snapshot summary.
221221
([#5376](https://github.com/facebook/jest/pull/5376),
222222
[5389](https://github.com/facebook/jest/pull/5389/))

packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3840,6 +3840,15 @@ Received:
38403840
<red>{\\"a\\": undefined}</>"
38413841
`;
38423842

3843+
exports[`toMatchObject() {pass: true} expect({}).toMatchObject({"a": undefined, "b": "b"}) 1`] = `
3844+
"<dim>expect(</><red>received</><dim>).not.toMatchObject(</><green>expected</><dim>)</>
3845+
3846+
Expected value not to match object:
3847+
<green>{\\"a\\": undefined, \\"b\\": \\"b\\"}</>
3848+
Received:
3849+
<red>{}</>"
3850+
`;
3851+
38433852
exports[`toMatchObject() {pass: true} expect(2015-11-30T00:00:00.000Z).toMatchObject(2015-11-30T00:00:00.000Z) 1`] = `
38443853
"<dim>expect(</><red>received</><dim>).not.toMatchObject(</><green>expected</><dim>)</>
38453854

packages/expect/src/__tests__/matchers.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,15 @@ describe('.toHaveProperty()', () => {
953953
});
954954

955955
describe('toMatchObject()', () => {
956+
class Foo {
957+
get a() {
958+
return undefined;
959+
}
960+
get b() {
961+
return 'b';
962+
}
963+
}
964+
956965
[
957966
[{a: 'b', c: 'd'}, {a: 'b'}],
958967
[{a: 'b', c: 'd'}, {a: 'b', c: 'd'}],
@@ -974,6 +983,7 @@ describe('toMatchObject()', () => {
974983
[[], []],
975984
[new Error('foo'), new Error('foo')],
976985
[new Error('bar'), {message: 'bar'}],
986+
[new Foo(), {a: undefined, b: 'b'}],
977987
].forEach(([n1, n2]) => {
978988
it(`{pass: true} expect(${stringify(n1)}).toMatchObject(${stringify(
979989
n2,

0 commit comments

Comments
 (0)