Skip to content

Commit

Permalink
Added test case for #476 to prevent regressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Sep 3, 2011
1 parent 69941e6 commit 546d520
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/transports.xhr-polling.test.js
Expand Up @@ -950,6 +950,44 @@ module.exports = {
});
},

'test that emitting an error event doesnt throw': function (done) {
var cl = client(++ports)
, io = create(cl)

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

io.sockets.on('connection', function (socket) {
socket.on('disconnect', function () {
cl.end();
io.server.close();
done();
});
});

cl.handshake(function (sid) {
cl.get('/socket.io/{protocol}/xhr-polling/' + sid, function (res, msgs) {
res.statusCode.should.equal(200);
msgs.should.have.length(1);
msgs[0].should.eql({ type: 'noop', endpoint: '' });

cl.post(
'/socket.io/{protocol}/xhr-polling/' + sid
, parser.encodePacket({
type: 'event'
, name: 'error'
})
, function (res, data) {
res.statusCode.should.eql(200);
data.should.equal('1');
}
);
});
});
},

'test emitting an event to the server with data': function (done) {
var cl = client(++ports)
, io = create(cl)
Expand Down

0 comments on commit 546d520

Please sign in to comment.