Skip to content

Commit

Permalink
docs: fix error printout in .mockName() example (#12913)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrazauskas authored Sep 14, 2022
1 parent 459f986 commit 8ef4d86
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 30 deletions.
7 changes: 4 additions & 3 deletions docs/MockFunctionAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import TOCInline from '@theme/TOCInline';

### `mockFn.getMockName()`

Returns the mock name string set by calling `mockFn.mockName(value)`.
Returns the mock name string set by calling [`.mockName()`](#mockfnmocknamename).

### `mockFn.mock.calls`

Expand Down Expand Up @@ -277,10 +277,11 @@ expect(mockFn).toHaveBeenCalled();

Will result in this error:

```
```bash
expect(mockedFunction).toHaveBeenCalled()

Expected mock function "mockedFunction" to have been called, but it was not called.
Expected number of calls: >= 1
Received number of calls: 0
```

### `mockFn.mockReturnThis()`
Expand Down
2 changes: 1 addition & 1 deletion docs/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ const otherObj = {

## Mock Names

You can optionally provide a name for your mock functions, which will be displayed instead of "jest.fn()" in the test error output. Use this if you want to be able to quickly identify the mock function reporting an error in your test output.
You can optionally provide a name for your mock functions, which will be displayed instead of `'jest.fn()'` in the test error output. Use [`.mockName()`](MockFunctionAPI.md/#mockfnmocknamename) if you want to be able to quickly identify the mock function reporting an error in your test output.

```javascript
const myMockFn = jest
Expand Down
11 changes: 6 additions & 5 deletions website/versioned_docs/version-25.x/MockFunctionAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import TOCInline from '@theme/TOCInline';

### `mockFn.getMockName()`

Returns the mock name string set by calling `mockFn.mockName(value)`.
Returns the mock name string set by calling [`.mockName()`](#mockfnmocknamename).

### `mockFn.mock.calls`

Expand Down Expand Up @@ -177,9 +177,9 @@ const myMockFn = jest
console.log(myMockFn(), myMockFn(), myMockFn(), myMockFn());
```

### `mockFn.mockName(value)`
### `mockFn.mockName(name)`

Accepts a string to use in test result output in place of "jest.fn()" to indicate which mock function is being referenced.
Accepts a string to use in test result output in place of `'jest.fn()'` to indicate which mock function is being referenced.

For example:

Expand All @@ -191,10 +191,11 @@ expect(mockFn).toHaveBeenCalled();

Will result in this error:

```
```bash
expect(mockedFunction).toHaveBeenCalled()

Expected mock function "mockedFunction" to have been called, but it was not called.
Expected number of calls: >= 1
Received number of calls: 0
```

### `mockFn.mockReturnThis()`
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-25.x/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ const otherObj = {

## Mock Names

You can optionally provide a name for your mock functions, which will be displayed instead of "jest.fn()" in the test error output. Use this if you want to be able to quickly identify the mock function reporting an error in your test output.
You can optionally provide a name for your mock functions, which will be displayed instead of `'jest.fn()'` in the test error output. Use [`.mockName()`](MockFunctionAPI.md/#mockfnmocknamename) if you want to be able to quickly identify the mock function reporting an error in your test output.

```javascript
const myMockFn = jest
Expand Down
11 changes: 6 additions & 5 deletions website/versioned_docs/version-26.x/MockFunctionAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import TOCInline from '@theme/TOCInline';

### `mockFn.getMockName()`

Returns the mock name string set by calling `mockFn.mockName(value)`.
Returns the mock name string set by calling [`.mockName()`](#mockfnmocknamename).

### `mockFn.mock.calls`

Expand Down Expand Up @@ -177,9 +177,9 @@ const myMockFn = jest
console.log(myMockFn(), myMockFn(), myMockFn(), myMockFn());
```

### `mockFn.mockName(value)`
### `mockFn.mockName(name)`

Accepts a string to use in test result output in place of "jest.fn()" to indicate which mock function is being referenced.
Accepts a string to use in test result output in place of `'jest.fn()'` to indicate which mock function is being referenced.

For example:

Expand All @@ -191,10 +191,11 @@ expect(mockFn).toHaveBeenCalled();

Will result in this error:

```
```bash
expect(mockedFunction).toHaveBeenCalled()

Expected mock function "mockedFunction" to have been called, but it was not called.
Expected number of calls: >= 1
Received number of calls: 0
```

### `mockFn.mockReturnThis()`
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-26.x/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ const otherObj = {

## Mock Names

You can optionally provide a name for your mock functions, which will be displayed instead of "jest.fn()" in the test error output. Use this if you want to be able to quickly identify the mock function reporting an error in your test output.
You can optionally provide a name for your mock functions, which will be displayed instead of `'jest.fn()'` in the test error output. Use [`.mockName()`](MockFunctionAPI.md/#mockfnmocknamename) if you want to be able to quickly identify the mock function reporting an error in your test output.

```javascript
const myMockFn = jest
Expand Down
11 changes: 6 additions & 5 deletions website/versioned_docs/version-27.x/MockFunctionAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import TOCInline from '@theme/TOCInline';

### `mockFn.getMockName()`

Returns the mock name string set by calling `mockFn.mockName(value)`.
Returns the mock name string set by calling [`.mockName()`](#mockfnmocknamename).

### `mockFn.mock.calls`

Expand Down Expand Up @@ -187,9 +187,9 @@ const myMockFn = jest
console.log(myMockFn(), myMockFn(), myMockFn(), myMockFn());
```

### `mockFn.mockName(value)`
### `mockFn.mockName(name)`

Accepts a string to use in test result output in place of "jest.fn()" to indicate which mock function is being referenced.
Accepts a string to use in test result output in place of `'jest.fn()'` to indicate which mock function is being referenced.

For example:

Expand All @@ -201,10 +201,11 @@ expect(mockFn).toHaveBeenCalled();

Will result in this error:

```
```bash
expect(mockedFunction).toHaveBeenCalled()

Expected mock function "mockedFunction" to have been called, but it was not called.
Expected number of calls: >= 1
Received number of calls: 0
```

### `mockFn.mockReturnThis()`
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-27.x/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ const otherObj = {

## Mock Names

You can optionally provide a name for your mock functions, which will be displayed instead of "jest.fn()" in the test error output. Use this if you want to be able to quickly identify the mock function reporting an error in your test output.
You can optionally provide a name for your mock functions, which will be displayed instead of `'jest.fn()'` in the test error output. Use [`.mockName()`](MockFunctionAPI.md/#mockfnmocknamename) if you want to be able to quickly identify the mock function reporting an error in your test output.

```javascript
const myMockFn = jest
Expand Down
7 changes: 4 additions & 3 deletions website/versioned_docs/version-28.x/MockFunctionAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import TOCInline from '@theme/TOCInline';

### `mockFn.getMockName()`

Returns the mock name string set by calling `mockFn.mockName(value)`.
Returns the mock name string set by calling [`.mockName()`](#mockfnmocknamename).

### `mockFn.mock.calls`

Expand Down Expand Up @@ -277,10 +277,11 @@ expect(mockFn).toHaveBeenCalled();

Will result in this error:

```
```bash
expect(mockedFunction).toHaveBeenCalled()

Expected mock function "mockedFunction" to have been called, but it was not called.
Expected number of calls: >= 1
Received number of calls: 0
```

### `mockFn.mockReturnThis()`
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-28.x/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ const otherObj = {

## Mock Names

You can optionally provide a name for your mock functions, which will be displayed instead of "jest.fn()" in the test error output. Use this if you want to be able to quickly identify the mock function reporting an error in your test output.
You can optionally provide a name for your mock functions, which will be displayed instead of `'jest.fn()'` in the test error output. Use [`.mockName()`](MockFunctionAPI.md/#mockfnmocknamename) if you want to be able to quickly identify the mock function reporting an error in your test output.

```javascript
const myMockFn = jest
Expand Down
7 changes: 4 additions & 3 deletions website/versioned_docs/version-29.0/MockFunctionAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import TOCInline from '@theme/TOCInline';

### `mockFn.getMockName()`

Returns the mock name string set by calling `mockFn.mockName(value)`.
Returns the mock name string set by calling [`.mockName()`](#mockfnmocknamename).

### `mockFn.mock.calls`

Expand Down Expand Up @@ -277,10 +277,11 @@ expect(mockFn).toHaveBeenCalled();

Will result in this error:

```
```bash
expect(mockedFunction).toHaveBeenCalled()

Expected mock function "mockedFunction" to have been called, but it was not called.
Expected number of calls: >= 1
Received number of calls: 0
```

### `mockFn.mockReturnThis()`
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.0/MockFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ const otherObj = {

## Mock Names

You can optionally provide a name for your mock functions, which will be displayed instead of "jest.fn()" in the test error output. Use this if you want to be able to quickly identify the mock function reporting an error in your test output.
You can optionally provide a name for your mock functions, which will be displayed instead of `'jest.fn()'` in the test error output. Use [`.mockName()`](MockFunctionAPI.md/#mockfnmocknamename) if you want to be able to quickly identify the mock function reporting an error in your test output.

```javascript
const myMockFn = jest
Expand Down

0 comments on commit 8ef4d86

Please sign in to comment.