Files
socket.io/test/socket.js
Roman Shtylman 6bfd5b3f20 use invalid ip address for incorrect connection test
Ensures that a failed connection will fail immediately versus waiting
for some DNS to resolve. Some browsers are very persistent about
resolving DNS names and some ISPs will DNS hijack.
2014-01-15 13:58:41 -05:00

34 lines
828 B
JavaScript

var expect = require('expect.js');
var eio = require('../');
describe('Socket', function () {
this.timeout(10000);
describe('filterUpgrades', function () {
it('should return only available transports', function () {
var socket = new eio.Socket({'transports': ['polling']});
expect(socket.filterUpgrades(['polling','websocket'])).to.eql(['polling']);
});
});
describe('socketClosing', function(){
it('should not emit close on incorrect connection', function (done) {
var socket = new eio.Socket('ws://0.0.0.0:8080');
var closed = false;
socket.once('error', function(){
setTimeout(function(){
expect(closed).to.be(false);
done();
}, 20);
});
socket.on('close', function(){
closed = true;
});
});
});
});