Skip to content

Commit 0175728

Browse files
committed
docs: don't use alias methods
1 parent a30a52f commit 0175728

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
- `[*]` Depend on exact versions of monorepo dependencies instead of `^` range ([#14553](https://github.com/facebook/jest/pull/14553))
4545
- `[babel-jest, babel-preset-jest]` [**BREAKING**] Increase peer dependency of `@babel/core` to `^7.11` ([#14109](https://github.com/jestjs/jest/pull/14109))
4646
- `[jest-cli, jest-config, @jest/types]` [**BREAKING**] Remove deprecated `--init` argument ([#14490](https://github.com/jestjs/jest/pull/14490))
47+
- `[docs]` Don't use alias matchers in docs ([#14631](https://github.com/facebook/jest/pull/14631))
4748

4849
## 29.7.0
4950

docs/ExpectAPI.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ Check out the section on [Inline Snapshots](SnapshotTesting.md#inline-snapshots)
888888

889889
### `expect.anything()`
890890

891-
`expect.anything()` matches anything but `null` or `undefined`. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a non-null argument:
891+
`expect.anything()` matches anything but `null` or `undefined`. You can use it inside `toEqual` or `toHaveBeenCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a non-null argument:
892892

893893
```js
894894
test('map calls its argument with a non-null argument', () => {
@@ -900,7 +900,7 @@ test('map calls its argument with a non-null argument', () => {
900900

901901
### `expect.any(constructor)`
902902

903-
`expect.any(constructor)` matches anything that was created with the given constructor or if it's a primitive that is of the passed type. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a number:
903+
`expect.any(constructor)` matches anything that was created with the given constructor or if it's a primitive that is of the passed type. You can use it inside `toEqual` or `toHaveBeenCalledWith` instead of a literal value. For example, if you want to check that a mock function is called with a number:
904904

905905
```js
906906
class Cat {}
@@ -931,7 +931,7 @@ test('randocall calls its callback with a number', () => {
931931

932932
You can use it instead of a literal value:
933933

934-
- in `toEqual` or `toBeCalledWith`
934+
- in `toEqual` or `toHaveBeenCalledWith`
935935
- to match a property in `objectContaining` or `toMatchObject`
936936

937937
```js
@@ -1063,7 +1063,7 @@ describe('not.stringContaining', () => {
10631063

10641064
You can use it instead of a literal value:
10651065

1066-
- in `toEqual` or `toBeCalledWith`
1066+
- in `toEqual` or `toHaveBeenCalledWith`
10671067
- to match an element in `arrayContaining`
10681068
- to match a property in `objectContaining` or `toMatchObject`
10691069

docs/TimerMocks.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ test('calls the callback after 1 second', () => {
5353
timerGame(callback);
5454

5555
// At this point in time, the callback should not have been called yet
56-
expect(callback).not.toBeCalled();
56+
expect(callback).not.toHaveBeenCalled();
5757

5858
// Fast-forward until all timers have been executed
5959
jest.runAllTimers();
6060

6161
// Now our callback should have been called!
62-
expect(callback).toBeCalled();
62+
expect(callback).toHaveBeenCalled();
6363
expect(callback).toHaveBeenCalledTimes(1);
6464
});
6565
```
@@ -109,7 +109,7 @@ describe('infiniteTimerGame', () => {
109109
jest.runOnlyPendingTimers();
110110

111111
// At this point, our 1-second timer should have fired its callback
112-
expect(callback).toBeCalled();
112+
expect(callback).toHaveBeenCalled();
113113

114114
// And it should have created a new timer to start the game over in
115115
// 10 seconds
@@ -154,13 +154,13 @@ it('calls the callback after 1 second via advanceTimersByTime', () => {
154154
timerGame(callback);
155155

156156
// At this point in time, the callback should not have been called yet
157-
expect(callback).not.toBeCalled();
157+
expect(callback).not.toHaveBeenCalled();
158158

159159
// Fast-forward until all timers have been executed
160160
jest.advanceTimersByTime(1000);
161161

162162
// Now our callback should have been called!
163-
expect(callback).toBeCalled();
163+
expect(callback).toHaveBeenCalled();
164164
expect(callback).toHaveBeenCalledTimes(1);
165165
});
166166
```
@@ -181,12 +181,12 @@ it('calls the animation frame callback after advanceTimersToNextFrame()', () =>
181181
requestAnimationFrame(callback);
182182

183183
// At this point in time, the callback should not have been called yet
184-
expect(callback).not.toBeCalled();
184+
expect(callback).not.toHaveBeenCalled();
185185

186186
jest.advanceTimersToNextFrame();
187187

188188
// Now our callback should have been called!
189-
expect(callback).toBeCalled();
189+
expect(callback).toHaveBeenCalled();
190190
expect(callback).toHaveBeenCalledTimes(1);
191191
});
192192
```

docs/TutorialjQuery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ test('displays a user after a click', () => {
5454

5555
// Assert that the fetchCurrentUser function was called, and that the
5656
// #username span's inner text was updated as we'd expect it to.
57-
expect(fetchCurrentUser).toBeCalled();
57+
expect(fetchCurrentUser).toHaveBeenCalled();
5858
expect($('#username').text()).toBe('Johnny Cash - Logged In');
5959
});
6060
```

0 commit comments

Comments
 (0)