Skip to content

Commit ae9d527

Browse files
author
Tony Kovanen
committed
Add test to check that empty rooms are autopruned.
1 parent 3fe6d4e commit ae9d527

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/socket.io.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,24 @@ describe('socket.io', function(){
12911291
});
12921292
});
12931293
});
1294+
1295+
it('deletes empty rooms', function(done) {
1296+
var srv = http();
1297+
var sio = io(srv);
1298+
1299+
srv.listen(function(){
1300+
var socket = client(srv);
1301+
sio.on('connection', function(s){
1302+
s.join('a', function(){
1303+
expect(s.nsp.adapter.rooms).to.have.key('a');
1304+
s.leave('a', function(){
1305+
expect(s.nsp.adapter.rooms).to.not.have.key('a');
1306+
done();
1307+
});
1308+
});
1309+
});
1310+
});
1311+
});
12941312
});
12951313

12961314
describe('middleware', function(done){

0 commit comments

Comments
 (0)