
Target learners who know the basics of Node and how it works, including modules and creating functions. Refresh your knowledge with tutorials or videos about Node before joining this course.
Hi All,
These are the files used in the course, they have the project files AND test files, I suggest you delete / move test files somewhere for the moment while you go through the course and write your own tests along, only use them if you are stuck.
Learn how to test a node callback function with Mocha, validating the error-first pattern and a three result, using a delayed demo.js function and done signaling to pass two tests.
Explore sinon for test doubles, including spies and stubs, to isolate code in unit tests; install with npm install and save as a dev dependency.
Learn to use spies and test doubles in Node.js unit testing by spying on console.log and console.warn with sinon and sinon-chai, verifying calls, and restoring spies between tests.
Learn how to unit test utils.getHash by stubbing config secret and crypto, isolating the function, and chaining update and digest to produce a hash with md5.
Learn how to measure code coverage with Istanbul / NYC in node.js unit tests. Install NYC, set up a coverage script, run tests, and examine per-file coverage, including uncovered lines.
Explore test driven development in Node.js unit testing, starting with a failing test, writing the minimum code to pass, and iterating with Mocha and Chai to ensure backwards compatibility.
Mocking Require Statements
This is a focused, in-depth course about unit testing, where we will look at lots of code, and learn how to test it. We will go through everything from the simplest JavaScript function to ES6 classes & private code testing. We will also learn how to test your code coverage, so you always know where you stand.
One of the goals of this course is to teach you how to think about unit testing, and not simply teach you the basic syntax or how to call an assertion.
We will go through most scenarios you will run into day to day, as well as address a number of issues and examples ignored by most unit testing courses available online.
You should have some node experience, you don't need to be an expert, but you should at least know the basics.
I am always looking to improve the course, please send me any feedback you may have directly!
Please go ahead and add me on LinkedIn, I love to connect with my students (I also love endorsements :D)