Files
socket.io/test/socket.js
Roman Shtylman af1be0f46a add zuul support for easier browser testing
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
2013-11-18 15:15:15 -05:00

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);
});
});
});