Tag Archives: unit test

sinon vs rewire: when do I use which?

In node.js testing, there are 2 helper modules that I use often: sinon and rewire. Sinon allows you to monkey-patch functions, while rewire allows you to… monkey-patch functions. Both modules have other uses as well, but in this post I’m … Continue reading

Posted in JavaScript, node.js, software development, testing | Tagged , , , , , , , | Leave a comment

Automated software testing part 5: spying

Previous: part 4 – Next: part 6 You can also find the code below in the src/unit-test-3  dir of my blog code repository. Spying sounds really cool. I have to disappoint you. Unfortunately (or maybe not), spying in the world of unit … Continue reading

Posted in software development, testing | Tagged , , , , , , , | Leave a comment

Automated software testing part 4: combining similar tests

Previous: part 3 – Next: part 5 You can also find the code below in the src/unit-test-2   dir of my blog code repository. Today, you have been asked by your uncle to help him set up the new MegaBanana Slide in his Fun … Continue reading

Posted in software development, testing | Tagged , , , , , , , , | Leave a comment

Checking log4js output in your node.js testsuite

This post will teach you how to test  log4js  log statements in your code. You can also find the code below in the src/log4js-unittest dir of my blog code repository. Let’s say that we have written this simple node.js module, foo.js . … Continue reading

Posted in JavaScript, node.js, software development | Tagged , , , , , , , , , , , , , , | Leave a comment