Published via F: 2015-07-17 17:49:44
One of the first tools you need in your testing library is a good testing framework. We use Mocha exclusively at Clock. It is really simple to use and lets us keep our test files small and focused on one particular unit of code. Using the Behaviour-driven Development (BDD) interface of Mocha also makes our tests very readable and obvious to anyone as to what is being tested. A simple example of Mocha using the BDD interface would look like this:
The next tool you need is an assertion library. Our usual choice is Should JS. Should compliments Mocha with its BDD style interface which gives us the ability to string together very natural sounding function chains like this:


