Skip to content

Instantly share code, notes, and snippets.

@wactbprot
Created December 14, 2014 10:29
Show Gist options
  • Save wactbprot/f17723971f9a8865def6 to your computer and use it in GitHub Desktop.
Save wactbprot/f17723971f9a8865def6 to your computer and use it in GitHub Desktop.
failing testes crash nodejs if executed inside a ndata callback
var _ = require("underscore")
, ndata = require('../index')
, assert = require('assert')
, conf = {port: 9003}
, server
, client;
describe('ndata#known to fail', function () {
before("create server", function (done) {
server = ndata.createServer(conf);
server.on("ready", function(err){
client = ndata.createClient(conf);
done();
});
});
after("shut down server", function (done) {
server.destroy();
done();
});
describe('dont crashes node if test is outside a ndata callback; ok: ', function () {
it('should timeout', function (done) {
setTimeout(function(){
assert(false, true);
done();
}, 500)
});
describe('crashes node if test is inside a ndata callback; crash:', function () {
it('should set a value', function (done) {
client.set(["a", "b"], 1, function (err, value) {
assert(false, true);
done();
});
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment