How to do it...

Writing unit tests can be simpler or harder, depending on how you designed your code. If you work in a clear, side effects-free style, then writing functional tests will be quite simple. If you start adding complexities such as callbacks or promises and databases or filesystems, then you'll require more work, because you'll have to mock some of those elements; after all, you don't want to run tests on a production database, do you? 

In the following sections, we'll look at how we can write unit tests and learn how to work with some specific concepts such as mocks or spies.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset