mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
To run tests in a local browser: zuul --local 8080 -- test/index.js To run tests in the cloud via saucelabs: zuul -- test/index.js
30 lines
755 B
JavaScript
30 lines
755 B
JavaScript
var expect = require('expect.js');
|
|
var eio = require('../');
|
|
|
|
describe('Socket', function () {
|
|
|
|
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.on('close', function () {
|
|
closed = true;
|
|
});
|
|
|
|
setTimeout(function() {
|
|
expect(closed).to.be(false);
|
|
done();
|
|
}, 200);
|
|
});
|
|
});
|
|
|
|
});
|