Skip to content

Commit

Permalink
test: added io cookie handshake test
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Jul 2, 2012
1 parent f0ece1b commit 4fd56bf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/server.js
Expand Up @@ -49,6 +49,19 @@ describe('server', function () {
});

describe('handshake', function () {
it('should send the io cookie (xhr)', function (done) {
var engine = listen(function (port) {
request.get('http://localhost:%d/engine.io/default/'.s(port))
.send({ transport: 'polling' })
.end(function (res) {
// hack-obtain sid
var sid = res.text.match(/"sid":"([0-9]+)"/)[1];
expect(res.headers['set-cookie'][0]).to.be('io=' + sid);
done();
});
});
});

it('should register a new client', function (done) {
var engine = listen({ allowUpgrades: false }, function (port) {
expect(Object.keys(engine.clients)).to.have.length(0);
Expand Down

0 comments on commit 4fd56bf

Please sign in to comment.