From 46d069b3ccf3060c6d4921131fc26f7f482c56b9 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Mon, 24 Dec 2012 15:07:23 -0300 Subject: [PATCH] test: added room tracking test --- test/socket.io.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/socket.io.js b/test/socket.io.js index 1913b9093d..5c39d3ffc9 100644 --- a/test/socket.io.js +++ b/test/socket.io.js @@ -515,5 +515,26 @@ describe('socket.io', function(){ }); }); }); + + it('keeps track of rooms', function(done){ + var srv = http(); + var sio = io(srv); + + srv.listen(function(){ + var socket = client(srv); + sio.on('connection', function(s){ + s.join('a', function(){ + expect(s.rooms).to.eql([s.id, 'a']); + s.join('b', function(){ + expect(s.rooms).to.eql([s.id, 'a', 'b']); + s.leave('b', function(){ + expect(s.rooms).to.eql([s.id, 'a']); + done(); + }); + }); + }); + }); + }); + }); }); });