#4 - Mock (Using sinon) | Mocha - Javascript unit testing framework

preview_player
Показать описание
This is the 4th video tutorial of this web series on Mocha - Javascript unit testing framework. In this tutorial you will learn how to mock a method. A method should ideally be unit tested independently and it should have no impact of what's happening in other functions that are called from within it. In such cases, we must avoid the actual calls to those functions and should use dummy calls. It is possible that the other functions are taking too much time to complete - why should we wait for such methods to execute when these have no impact on the method that we are unit testing. Hence, such methods should be mocked.

#Mocha #UnitTesting #JavascriptUnitTesting #JSUnitTesting #Mock #Assertions #ChaiJS #Sinon #Mocking #MockFunction

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.

► This series:

► Recommended videos

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

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

great explanation, not enough views and that is to bad. thanks

vedran
Автор

Great job explaining these concepts in simple to understand manner. 👍

mitakshgupta
Автор

Thank you very much! Really great explanation. I've read a bunch of articles and your video made me understand this mock stuff. Thanks again!

AnaHelena
Автор

you spelt "expectation" wrong though :P

pauline
welcome to shbcf.ru