Skip to content

Instantly share code, notes, and snippets.

Last active Jun 1, 2018
What would you like to do?
chai-spies: How to test async callbacks
const Chai = require('chai');
const Spies = require('chai-spies');
const original = function(callback) {
setTimeout(callback, 0);
it("async callback should be called with Spy", function() {
const callback = Chai.spy();
// Doesn't work here.
it("async callback should be called without Spy", function(done) {
// Does work.
original(() => done());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment