Skip to content

Instantly share code, notes, and snippets.

@kevinswiber
Created November 25, 2015 23:10
Show Gist options
  • Save kevinswiber/9d2c82b764b7c011355a to your computer and use it in GitHub Desktop.
Save kevinswiber/9d2c82b764b7c011355a to your computer and use it in GitHub Desktop.
Testing to see if function call works without a callback.
var assert = require('assert');
function maybeCallback(callback) {
setTimeout(function() {
callback();
}, 5000);
};
describe('maybeCallback', function() {
it('should execute without a callback function', function(done) {
this.timeout(10000);
var error = null;
try {
maybeCallback();
} catch (ex) {
error = ex;
}
setTimeout(function() {
if (error) {
assert(false);
}
done();
}, 5000);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment