#5 - Stub (Using sinon) | Mocha - Javascript unit testing framework

preview_player
Показать описание
This is the 5th video tutorial of this web series on Mocha - Javascript unit testing framework. In the previous video tutorial, we learnt about mocking a method when a method has no impact on the caller. But there could be a scenarios that callee returns something that is useful and required for the unit testing of the caller. In such cases, we would need to stub the response. Using the sinon library, we can achieve it quite easily. Same has been explained in this tutorial.

#Mocha #UnitTesting #JavascriptUnitTesting #JSUnitTesting #Stub #Assertions #ChaiJS #Sinon #StubResponse #StubFunctions #Stubbing

Mocha unit testing framework is the most popular framework for Javascript unit testing. In this web series, I have used other popular libraries
- Chai - as assertion library with expect interface
- Sinon - for spies, mocks and stubs
- Nock - for xhr interception and mocking
- Nyc - Unit test coverage report and its important configurations

Hope you will learn good from this course. Let me know your feedback, suggestions - I will really appreciate it.

#Mocha #UnitTesting #JavascriptUnitTesting #JSUnitTesting #Stub #Assertions #ChaiJS #Sinon #StubMethods #StubFunctions

► This series:

► Recommended videos

► If you are looking to start with GIT, you can have a look at the following videos:

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

This by far is the best playlist that teaching about unit testing in general and sinon in particular, very well done, all the concepts and examples are easy to understand. Love your work :D

jackiedo
Автор

Honestly, guy is explaining better than the lessons i took from Pluralsight.

ozanyldr
Автор

This was so fast and easy to understand.

muhammadfaizan
Автор

Thank you so much for making this concept very easy.

rishidadheech
Автор

Thank you so much! Finally I can test my controllers!

glimpsee
Автор

Could you explain what myObj is? I know that you pass that along with the method name, but what is myObject, and what if you don't have an object to pass in the stub other then the method?

arctic_frost
join shbcf.ru