Package Spotlight: Chai

Package Spotlight: Chai

Chai is a TDD (test-driven development) and BDD (behavior-driven development) assertion library for JavaScript. This package allows you to assert what a test should have as a result. As a simple example consider the mathematical expression 2 + 2. You would assert that 2 + 2 = 4. If the actual result of that calculation is 4 the test passes. Any other result causes the assertion to fail.

An assertion library is a critical piece to being able to test the code that exists in the system. We have at least 5,000 assertions in our test cases (and growing). We have this many because we want to test many different instances. Say, as an example, we return a specific error code if someone doesn’t pass an expected result. We need an assert statement for each possible value that isn’t the expected to make sure the test passes (and therefore the code returns the failure as we would expect.)

Package Name: Chai
Website: https://www.chaijs.com/

a woman sitting at a table using a laptop computer
Blog
Virginia

Seven Ideas for Slow Season

It’s hard to avoid having an “off-season” in any business. This is especially true in the tourism industry. By its very nature, the travel industry

Read More »

Request a Demonstration