Posts tagged with chai

  • Adding mocha unit tests

    In this post, I’ll add unit tests to the example application that I’ve been fiddling around with in the recent posts.

  • Functional Testing - Hiding Async

    In the previous post, we explored the Page Object pattern and rewrote our tests to use this technique. Sometimes, it can be that the tests appear to be a bit verbose due to the usage of promises. Additionally, promises and asynchronous programming in general can be somewhat confusing to developers. Let’s see some ways of making the tests shorter and easier to read.

  • Using sinon spies

    In the previous post, we implemented a new feature for our calculator: it makes a bell sound when you divide by zero. The bell is a simple function that the calculator calls and it is provided as a constructor dependency. We wrote a unit test for this as well, but the code for that is a bit verbose. Let’s see how we can use a mocking library like sinon to reduce and standardize the testing code.

  • A closer look to a basic unit test

    In the previous post we started writing a basic Calculator class and added the first unit test. Let’s have a closer look at that unit test and extend our calculator with more features.

  • Chai as promised with Chai string

    Here’s a small tip that puzzled us at work the other day for a while. How do you use chai-as-promised together with chai-string?

  • Adventures with automated browser tests in JavaScript

    This is a long post, be advised! It goes through the adventures we have had at work with automated browser tests in JavaScript. It has been a journey full of challenges and knowledge build up, a journey that still goes on!

This site uses third party cookies from Google Analytics and Google AdSense Accept and close popup