@@ -571,6 +571,8 @@ describe('drinkAll', () => {
571571
572572### ` .toHaveBeenCalledTimes(number) `
573573
574+ Also under the alias: ` .toBeCalledTimes(number) `
575+
574576Use ` .toHaveBeenCalledTimes ` to ensure that a mock function got called exact
575577number of times.
576578
@@ -626,10 +628,12 @@ test('applying to all flavors does mango last', () => {
626628});
627629```
628630
629- ### ` .nthCalledWith(nthCall, arg1, arg2, ....) `
631+ ### ` .toHaveBeenNthCalledWith(nthCall, arg1, arg2, ....) `
632+
633+ Also under the alias: ` .nthCalledWith(arg1, arg2, ...) `
630634
631- If you have a mock function, you can use ` .nthCalledWith ` to test what arguments
632- it was nth called with. For example, let's say you have a
635+ If you have a mock function, you can use ` .toHaveBeenNthCalledWith ` to test what
636+ arguments it was nth called with. For example, let's say you have a
633637` drinkEach(drink, Array<flavor>) ` function that applies ` f ` to a bunch of
634638flavors, and you want to ensure that when you call it, the first flavor it
635639operates on is ` 'lemon' ` and the second one is ` 'octopus' ` . You can write:
@@ -640,8 +644,8 @@ Note that, nth argument must be positive integer starting from 1.
640644test (' drinkEach drinks each drink' , () => {
641645 const drink = jest .fn ();
642646 drinkEach (drink, [' lemon' , ' octopus' ]);
643- expect (drink).nthCalledWith (1 , ' lemon' );
644- expect (drink).nthCalledWith (2 , ' octopus' );
647+ expect (drink).toHaveBeenNthCalledWith (1 , ' lemon' );
648+ expect (drink).toHaveBeenNthCalledWith (2 , ' octopus' );
645649});
646650```
647651
0 commit comments