@@ -503,7 +503,7 @@ it('transitions as expected', () => {
503503test (' map calls its argument with a non-null argument' , () => {
504504 const mock = jest .fn ();
505505 [1 ].map (x => mock (x));
506- expect (mock).toBeCalledWith (expect .anything ());
506+ expect (mock).toHaveBeenCalledWith (expect .anything ());
507507});
508508```
509509
@@ -520,7 +520,7 @@ function getCat(fn) {
520520test (' randocall calls its callback with a class instance' , () => {
521521 const mock = jest .fn ();
522522 getCat (mock);
523- expect (mock).toBeCalledWith (expect .any (Cat));
523+ expect (mock).toHaveBeenCalledWith (expect .any (Cat));
524524});
525525
526526function randocall (fn ) {
@@ -530,7 +530,7 @@ function randocall(fn) {
530530test (' randocall calls its callback with a number' , () => {
531531 const mock = jest .fn ();
532532 randocall (mock);
533- expect (mock).toBeCalledWith (expect .any (Number ));
533+ expect (mock).toHaveBeenCalledWith (expect .any (Number ));
534534});
535535```
536536
@@ -709,7 +709,7 @@ For example, let's say that we expect an `onPress` function to be called with an
709709test (' onPress gets called with the right thing' , () => {
710710 const onPress = jest .fn ();
711711 simulatePresses (onPress);
712- expect (onPress).toBeCalledWith (
712+ expect (onPress).toHaveBeenCalledWith (
713713 expect .objectContaining ({
714714 x: expect .any (Number ),
715715 y: expect .any (Number ),
@@ -1548,15 +1548,15 @@ test('throws on octopus', () => {
15481548 }
15491549
15501550 // Test that the error message says "yuck" somewhere: these are equivalent
1551- expect (drinkOctopus).toThrowError (/ yuck/ );
1552- expect (drinkOctopus).toThrowError (' yuck' );
1551+ expect (drinkOctopus).toThrow (/ yuck/ );
1552+ expect (drinkOctopus).toThrow (' yuck' );
15531553
15541554 // Test the exact error message
1555- expect (drinkOctopus).toThrowError (/ ^ yuck, octopus flavor$ / );
1556- expect (drinkOctopus).toThrowError (new Error (' yuck, octopus flavor' ));
1555+ expect (drinkOctopus).toThrow (/ ^ yuck, octopus flavor$ / );
1556+ expect (drinkOctopus).toThrow (new Error (' yuck, octopus flavor' ));
15571557
15581558 // Test that we get a DisgustingFlavorError
1559- expect (drinkOctopus).toThrowError (DisgustingFlavorError);
1559+ expect (drinkOctopus).toThrow (DisgustingFlavorError);
15601560});
15611561```
15621562
0 commit comments