Merge pull request #1792 from rase-/add/autopruning-test

Add room autopruning test
This commit is contained in:
Tony Kovanen
2014-09-22 12:25:23 -06:00
2 changed files with 19 additions and 1 deletions

View File

@@ -22,7 +22,7 @@
"engine.io": "1.4.0",
"socket.io-parser": "2.2.1",
"socket.io-client": "1.1.0",
"socket.io-adapter": "0.2.0",
"socket.io-adapter": "Automattic/socket.io-adapter#006f19",
"has-binary-data": "0.1.3",
"debug": "0.7.4"
},

View File

@@ -1291,6 +1291,24 @@ describe('socket.io', function(){
});
});
});
it('deletes empty 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.nsp.adapter.rooms).to.have.key('a');
s.leave('a', function(){
expect(s.nsp.adapter.rooms).to.not.have.key('a');
done();
});
});
});
});
});
});
describe('middleware', function(done){