How to Stub Dependencies with Sinon | JavaScript Testing Tutorials

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

I've watched tons of videos lately on mocking/stubbing, and you've done the best job laying it plainly and succinctly. Thank you!

carylwyatt
Автор

Passing arrow functions (aka "lambdas") to Mocha is discouraged. Lambdas lexically bind this and cannot access the Mocha context.

sujeetagrahari
Автор

Great lecture Kris. Would you also do a lecture on sinon mock?

ThuyNguyen-buge
Автор

Simple and clear explanation, Awesome Job @Code With Kris

umamaheshmeka
Автор

I appreciate the tutorial but in this case aren’t you stubbing the thing you’re testing? If you’re testing the endpoint then stubbing the endpoint, then what purpose does the test serve?

MrLeewallen
Автор

Really good content! I'd suggest normalizing your audio a bit, I had my volume all the way up to hear you and when I got to an ad it blew the whole neighborhood away 😅

DutchmanRadio
Автор

What if API (response) has changed? This unit test will still work and pass but service will finally fail. What is the sense just to mock API response? This way we can adjust unit test so it newer fails but really doesn't indicate the problem

georgeyan
Автор

may i know how can we stub component methods ?

vaasavkumar
Автор

Have you ever mocked or stubbed the upload method of Cloudinary dependency? It is located into two namespaces called v2 and uploader. Are there other thing to consider for?
I tried exactly your steps but I am getting the ENOTFOUND error running the test without Internet connection. So, it seems the upload method is attempting to reach Cloudinary's API even when it got stubbed.

santiagorestrepo
Автор

Simply amazing man!


Credits: @CodeWithKris

minutesseries