Skip to content

Commit

Permalink
docs: use toContainEqual in MockFunctions example (#8765)
Browse files Browse the repository at this point in the history
* Update MockFunctions - toContain -> toContainEqual

toContain won't work in this case, because it will try to compare arrays with Object.is, not equality.

* Update CHANGELOG.md

* Update order docs MockFunctions
  • Loading branch information
felipepastorelima authored and thymikee committed Jul 31, 2019
1 parent 88ccda0 commit 2cd7576
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
- `[docs]` Updated react tutorial to refer to new package of react-testing-library (@testing-library/react) ([#8753](https://github.com/facebook/jest/pull/8753))
- `[docs]` Updated imports of react-testing-library to @testing-library/react in website ([#8757](https://github.com/facebook/jest/pull/8757))
- `[jest-core]` Add `getVersion` (moved from `jest-cli`) ([#8706](https://github.com/facebook/jest/pull/8706))
- `[docs]` Fix MockFunctions example that was using toContain instead of toContainEqual ([#8765](https://github.com/facebook/jest/pull/8765))

### Performance

Expand Down
2 changes: 1 addition & 1 deletion docs/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ These matchers are really just sugar for common forms of inspecting the `.mock`
expect(mockFunc.mock.calls.length).toBeGreaterThan(0);

// The mock function was called at least once with the specified args
expect(mockFunc.mock.calls).toContain([arg1, arg2]);
expect(mockFunc.mock.calls).toContainEqual([arg1, arg2]);

// The last call to the mock function was called with the specified args
expect(mockFunc.mock.calls[mockFunc.mock.calls.length - 1]).toEqual([
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-22.x/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ These matchers are really just sugar for common forms of inspecting the `.mock`
expect(mockFunc.mock.calls.length).toBeGreaterThan(0);

// The mock function was called at least once with the specified args
expect(mockFunc.mock.calls).toContain([arg1, arg2]);
expect(mockFunc.mock.calls).toContainEqual([arg1, arg2]);

// The last call to the mock function was called with the specified args
expect(mockFunc.mock.calls[mockFunc.mock.calls.length - 1]).toEqual([
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-23.x/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ These matchers are really just sugar for common forms of inspecting the `.mock`
expect(mockFunc.mock.calls.length).toBeGreaterThan(0);

// The mock function was called at least once with the specified args
expect(mockFunc.mock.calls).toContain([arg1, arg2]);
expect(mockFunc.mock.calls).toContainEqual([arg1, arg2]);

// The last call to the mock function was called with the specified args
expect(mockFunc.mock.calls[mockFunc.mock.calls.length - 1]).toEqual([
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-24.0/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ These matchers are really just sugar for common forms of inspecting the `.mock`
expect(mockFunc.mock.calls.length).toBeGreaterThan(0);

// The mock function was called at least once with the specified args
expect(mockFunc.mock.calls).toContain([arg1, arg2]);
expect(mockFunc.mock.calls).toContainEqual([arg1, arg2]);

// The last call to the mock function was called with the specified args
expect(mockFunc.mock.calls[mockFunc.mock.calls.length - 1]).toEqual([
Expand Down

0 comments on commit 2cd7576

Please sign in to comment.