Skip to content

Commit

Permalink
docs: Expand changelog entry for #5367 (#5719)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored and cpojer committed Mar 4, 2018
1 parent e9aa321 commit ecb5836
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@
malformed source-map. ([#5405](https://github.com/facebook/jest/pull/5405)).
* `[jest]` Add `import-local` to `jest` package.
([#5353](https://github.com/facebook/jest/pull/5353))
* `[expect]` Support class instances in `.toHaveProperty()` matcher.
([#5367](https://github.com/facebook/jest/pull/5367))
* `[expect]` Support class instances in `.toHaveProperty()` and `.toMatchObject`
matcher. ([#5367](https://github.com/facebook/jest/pull/5367))
* `[jest-cli]` Fix npm update command for snapshot summary.
([#5376](https://github.com/facebook/jest/pull/5376),
[5389](https://github.com/facebook/jest/pull/5389/))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3840,6 +3840,15 @@ Received:
<red>{\\"a\\": undefined}</>"
`;

exports[`toMatchObject() {pass: true} expect({}).toMatchObject({"a": undefined, "b": "b"}) 1`] = `
"<dim>expect(</><red>received</><dim>).not.toMatchObject(</><green>expected</><dim>)</>

Expected value not to match object:
<green>{\\"a\\": undefined, \\"b\\": \\"b\\"}</>
Received:
<red>{}</>"
`;

exports[`toMatchObject() {pass: true} expect(2015-11-30T00:00:00.000Z).toMatchObject(2015-11-30T00:00:00.000Z) 1`] = `
"<dim>expect(</><red>received</><dim>).not.toMatchObject(</><green>expected</><dim>)</>

Expand Down
10 changes: 10 additions & 0 deletions packages/expect/src/__tests__/matchers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,15 @@ describe('.toHaveProperty()', () => {
});

describe('toMatchObject()', () => {
class Foo {
get a() {
return undefined;
}
get b() {
return 'b';
}
}

[
[{a: 'b', c: 'd'}, {a: 'b'}],
[{a: 'b', c: 'd'}, {a: 'b', c: 'd'}],
Expand All @@ -974,6 +983,7 @@ describe('toMatchObject()', () => {
[[], []],
[new Error('foo'), new Error('foo')],
[new Error('bar'), {message: 'bar'}],
[new Foo(), {a: undefined, b: 'b'}],
].forEach(([n1, n2]) => {
it(`{pass: true} expect(${stringify(n1)}).toMatchObject(${stringify(
n2,
Expand Down

0 comments on commit ecb5836

Please # to comment.