kentcdodds / js-mocking-fundamentals

JavaScript Mocking Fundamentals on TestingJavaScript.com
https://testingjavascript.com/courses/javascript-mocking-fundamentals
Other
306 stars 286 forks source link

jest.spyOn behaviour #3

Closed Miklet closed 4 years ago

Miklet commented 4 years ago

Hi Kent!

I would like to ask you about jest.spyOn. In your course you have mentioned that spyOn does replace original implementation with an empty mock function. According to Jest's documentation and my own experience with using that function it doesn't by default. Was that a mistake :)?

Cheers and thank you for your awesome job!

kentcdodds commented 4 years ago

You're correct. Where do I say that?

Miklet commented 4 years ago

Here: https://testingjavascript.com/lessons/jest-restore-the-original-implementation-of-a-mocked-javascript-function-with-jest-spyon at 0:26 it starts.

kentcdodds commented 4 years ago

Yep. That's wrong. Thanks for letting me know. I'll look into getting that fixed.

Miklet commented 4 years ago

You're welcome!

kentcdodds commented 4 years ago

This has been fixed. Thanks!