diff --git a/support/test-runner/app.js b/support/test-runner/app.js index 3a06f9b..229ec35 100644 --- a/support/test-runner/app.js +++ b/support/test-runner/app.js @@ -180,9 +180,15 @@ suite('socket.test.js', function () { }); server('test different namespace connection methods', function (io) { - io.of('/a').on('connection', function (socket) {}); - io.of('/b').on('connection', function (socket) {}); - io.of('/c').on('connection', function (socket) {}); + io.of('/a').on('connection', function (socket) { + socket.send('a'); + }); + io.of('/b').on('connection', function (socket) { + socket.send('b'); + }); + io.of('/c').on('connection', function (socket) { + socket.send('c'); + }); }); server('test disconnecting from namespaces', function (io) { diff --git a/test/socket.test.js b/test/socket.test.js index 12c61d6..8fd1637 100644 --- a/test/socket.test.js +++ b/test/socket.test.js @@ -140,28 +140,42 @@ 'test different namespace connection methods': function (next) { var io = create('/a') , connect = 0 + , message = 0 , socket = io.socket; function finish () { socket.of('').disconnect(); connect.should().equal(3); + message.should().equal(3); next(); } io.on('connect', function () { - if (++connect === 3) finish(); + ++connect; + }).on('message', function (data) { + data.should().eql('a'); + + if (++message === 3) finish(); }).on('error', function (msg) { throw new Error(msg || 'Received an error'); }); socket.of('/b').on('connect', function () { - if (++connect === 3) finish(); + ++connect; + }).on('message', function (data) { + data.should().eql('b'); + + if (++message === 3) finish(); }).on('error', function (msg) { throw new Error(msg || 'Received an error'); }); io.of('/c').on('connect', function () { - if (++connect === 3) finish(); + ++connect; + }).on('message', function (data) { + data.should().eql('c'); + + if (++message === 3) finish(); }).on('error', function (msg) { throw new Error(msg || 'Received an error'); });