Skip to content

Commit

Permalink
docs: update toHaveBeenCalledWith to include type of equality check (
Browse files Browse the repository at this point in the history
  • Loading branch information
Biki-das authored Feb 7, 2022
1 parent 7aadc37 commit 92f3279
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ test('drinkEach drinks each drink', () => {

Also under the alias: `.toBeCalledWith()`

Use `.toHaveBeenCalledWith` to ensure that a mock function was called with specific arguments.
Use `.toHaveBeenCalledWith` to ensure that a mock function was called with specific arguments. The arguments are checked with the same algorithm that `.toEqual` uses.

For example, let's say that you can register a beverage with a `register` function, and `applyToAll(f)` should apply the function `f` to all registered beverages. To make sure this works, you could write:

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-25.x/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ test('drinkEach drinks each drink', () => {

Also under the alias: `.toBeCalledWith()`

Use `.toHaveBeenCalledWith` to ensure that a mock function was called with specific arguments.
Use `.toHaveBeenCalledWith` to ensure that a mock function was called with specific arguments. The arguments are checked with the same algorithm that `.toEqual` uses.

For example, let's say that you can register a beverage with a `register` function, and `applyToAll(f)` should apply the function `f` to all registered beverages. To make sure this works, you could write:

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-26.x/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ test('drinkEach drinks each drink', () => {

Also under the alias: `.toBeCalledWith()`

Use `.toHaveBeenCalledWith` to ensure that a mock function was called with specific arguments.
Use `.toHaveBeenCalledWith` to ensure that a mock function was called with specific arguments. The arguments are checked with the same algorithm that `.toEqual` uses.

For example, let's say that you can register a beverage with a `register` function, and `applyToAll(f)` should apply the function `f` to all registered beverages. To make sure this works, you could write:

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-27.0/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ Although the `.toBe` matcher **checks** referential identity, it **reports** a d

Also under the alias: `.toBeCalled()`

Use `.toHaveBeenCalled` to ensure that a mock function got called.
Use `.toHaveBeenCalledWith` to ensure that a mock function was called with specific arguments. The arguments are checked with the same algorithm that `.toEqual` uses.

For example, let's say you have a `drinkAll(drink, flavour)` function that takes a `drink` function and applies it to all available beverages. You might want to check that `drink` gets called for `'lemon'`, but not for `'octopus'`, because `'octopus'` flavour is really weird and why would anything be octopus-flavoured? You can do that with this test suite:

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-27.1/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ Although the `.toBe` matcher **checks** referential identity, it **reports** a d

Also under the alias: `.toBeCalled()`

Use `.toHaveBeenCalled` to ensure that a mock function got called.
Use `.toHaveBeenCalledWith` to ensure that a mock function was called with specific arguments. The arguments are checked with the same algorithm that `.toEqual` uses.

For example, let's say you have a `drinkAll(drink, flavour)` function that takes a `drink` function and applies it to all available beverages. You might want to check that `drink` gets called for `'lemon'`, but not for `'octopus'`, because `'octopus'` flavour is really weird and why would anything be octopus-flavoured? You can do that with this test suite:

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-27.2/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ Although the `.toBe` matcher **checks** referential identity, it **reports** a d

Also under the alias: `.toBeCalled()`

Use `.toHaveBeenCalled` to ensure that a mock function got called.
Use `.toHaveBeenCalledWith` to ensure that a mock function was called with specific arguments. The arguments are checked with the same algorithm that `.toEqual` uses.

For example, let's say you have a `drinkAll(drink, flavour)` function that takes a `drink` function and applies it to all available beverages. You might want to check that `drink` gets called for `'lemon'`, but not for `'octopus'`, because `'octopus'` flavour is really weird and why would anything be octopus-flavoured? You can do that with this test suite:

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-27.4/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ Although the `.toBe` matcher **checks** referential identity, it **reports** a d

Also under the alias: `.toBeCalled()`

Use `.toHaveBeenCalled` to ensure that a mock function got called.
Use `.toHaveBeenCalledWith` to ensure that a mock function was called with specific arguments. The arguments are checked with the same algorithm that `.toEqual` uses.

For example, let's say you have a `drinkAll(drink, flavour)` function that takes a `drink` function and applies it to all available beverages. You might want to check that `drink` gets called for `'lemon'`, but not for `'octopus'`, because `'octopus'` flavour is really weird and why would anything be octopus-flavoured? You can do that with this test suite:

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-27.5/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ Although the `.toBe` matcher **checks** referential identity, it **reports** a d

Also under the alias: `.toBeCalled()`

Use `.toHaveBeenCalled` to ensure that a mock function got called.
Use `.toHaveBeenCalledWith` to ensure that a mock function was called with specific arguments. The arguments are checked with the same algorithm that `.toEqual` uses.

For example, let's say you have a `drinkAll(drink, flavour)` function that takes a `drink` function and applies it to all available beverages. You might want to check that `drink` gets called for `'lemon'`, but not for `'octopus'`, because `'octopus'` flavour is really weird and why would anything be octopus-flavoured? You can do that with this test suite:

Expand Down

0 comments on commit 92f3279

Please sign in to comment.