Skip to content

Commit

Permalink
fixed websocket testing, removed seemingly irrelevant tests
Browse files Browse the repository at this point in the history
  • Loading branch information
einaros committed Oct 25, 2011
1 parent 2bdee1b commit c88ea9e
Showing 1 changed file with 1 addition and 129 deletions.
130 changes: 1 addition & 129 deletions test/transports.websocket.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,140 +236,12 @@ module.exports = {
});
},

'test sending undeliverable volatile messages': function (done) {
var cl = client(++ports)
, io = create(cl)
, messages = 0
, messaged = false
, s;

io.configure(function () {
io.set('close timeout', .05);
});

io.sockets.on('connection', function (socket) {
s = socket;

socket.on('disconnect', function () {
messaged.should.be.false;
cl.end();
io.server.close();
done();
});
});

cl.handshake(function (sid) {
var ws = websocket(cl, sid);
ws.on('message', function (msg) {
msg.type.should.eql('connect');
ws.finishClose();

setTimeout(function () {
s.volatile.send('ah wha wha');

ws = websocket(cl, sid);
ws.on('message', function () {
messaged = true;
});

setTimeout(function () {
ws.finishClose();
}, 10);
}, 10);
});
});
},

'test sending undeliverable volatile json': function (done) {
var cl = client(++ports)
, io = create(cl)
, messaged = false
, s;

io.configure(function () {
io.set('close timeout', .05);
});

io.sockets.on('connection', function (socket) {
s = socket;

socket.on('disconnect', function () {
messaged.should.be.false;
cl.end();
io.server.close();
done();
});
});

cl.handshake(function (sid) {
var ws = websocket(cl, sid);
ws.on('message', function () {
ws.finishClose();

setTimeout(function () {
s.volatile.json.send({ a: 'b' });

ws = websocket(cl, sid);
ws.on('message', function () {
messaged = true;
});

setTimeout(function () {
ws.finishClose();
}, 10);
}, 10);
});
});
},

'test sending undeliverable volatile events': function (done) {
var cl = client(++ports)
, io = create(cl)
, messaged = false
, s;

io.configure(function () {
io.set('close timeout', .05);
});

io.sockets.on('connection', function (socket) {
s = socket;

socket.on('disconnect', function () {
messaged.should.be.false;
cl.end();
io.server.close();
done();
});
});

cl.handshake(function (sid) {
var ws = websocket(cl, sid);
ws.on('message', function () {
ws.finishClose();

setTimeout(function () {
s.volatile.emit({ a: 'b' });

ws = websocket(cl, sid);
ws.on('message', function () {
messaged = true;
});

setTimeout(function () {
ws.finishClose();
}, 10);
}, 10);
});
});
},

'test sending deliverable volatile messages': function (done) {
var cl = client(++ports)
, io = create(cl)
, messages = 0
, messaged = false;

io.configure(function () {
io.set('close timeout', .05);
});
Expand Down

0 comments on commit c88ea9e

Please sign in to comment.