Top "Chai" questions

Chai is a BDD/TDD assertion library for Node.

Correct way to unit test Express Middleware

I have a piece of Express middleware that is set to check for a valid Content-Type header in all of …

node.js unit-testing express mocha chai
How to resolve "Cannot read property 'should' of undefined" in chai?

I'm trying to test my test my RESTful nodejs API but keep running into the following error. Uncaught TypeError: Cannot …

node.js mocha chai
Sinon spy on console.log call not registered

I'm trying to learn about Sinon and want to spy on console.log. The code is simple: function logToConsole() { console.…

javascript testing mocha sinon chai
How to unit test this Redux thunk?

So I have this Redux action creator that is using redux thunk middleware: accountDetailsActions.js: export function updateProduct(product) { return (…

javascript redux chai
What is the difference between equal and eql in Chai Library

I'm pretty new to JavaScript, and I have a quick question regarding the Chai library for making unit tests. When …

javascript unit-testing chai
How does the expect().to.be.true work in Chai?

expect(true).to.be.true; In this code, all the 'to', 'be', 'true' seems to be an attribute of the …

javascript chai
How do I expect a function to be called with specific args with sinon, mocha, and chai in nodejs?

I have been having a problem trying to make sure Q.ninvoke is called with the args I am passing …

node.js mocha.js sinon chai sinon-chai
How to make Istanbul generate coverage for all of my source code?

Currently Istanbul is only generating coverage for files that are used in my tests, which is okay, but seems to …

node.js mocha sinon chai istanbul
How to repeat/loop through mocha tests

I've been working on a few mocha/chai tests, and I still haven't found a good way of running my …

tdd mocha chai
Chai response.body is always empty {}

No matter what my server actually returns, Chai always gives me this exception when I assert response.body: Uncaught AssertionError: …

node.js mocha chai