mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
34 lines
830 B
JavaScript
34 lines
830 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://localhost:8080');
|
|
var closed = false;
|
|
|
|
socket.once('error', function(){
|
|
setTimeout(function(){
|
|
expect(closed).to.be(false);
|
|
done();
|
|
}, 20);
|
|
});
|
|
|
|
socket.on('close', function(){
|
|
closed = true;
|
|
});
|
|
});
|
|
});
|
|
|
|
});
|