Skip to content

Instantly share code, notes, and snippets.

@nkzawa
Created October 19, 2014 02:09
Show Gist options
  • Save nkzawa/6d69f5b7fd9f48832cc0 to your computer and use it in GitHub Desktop.
Save nkzawa/6d69f5b7fd9f48832cc0 to your computer and use it in GitHub Desktop.
it('should fire connect event on reconnect', function(done){
var socket = io({ forceNew: true });
var count = 0;
socket.on('connect', function() {
socket.on('myevent', function() {});
if (++count === 1) return;
expect(socket.listeners('myevent')).to.have.length(2);
socket.disconnect();
done();
});
setTimeout(function() {
socket.io.engine.close();
}, 500);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment