Chai Assertion Library

chai
Just what is the Chai Assertion Library?

From their website: Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework.

Once you see the examples you start to get the idea:

Should

chai.should();

foo.should.be.a('string');
foo.should.equal('bar');
foo.should.have.length(3);
tea.should.have.property('flavors')
  .with.length(3);

Any programmer who has spent a considerable amount of time tracking down a code error, only to realize that foo was a string when it should have been an integer can understand why an assertion library will save them time.

Chai takes the idea a step further by integrating plugins such as selenium-webdriver.

Read more about Chai on their website

Comments