From 2869f466be9fd566b1008798a7b0fc24ae2da41e Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sun, 22 May 2011 22:23:53 -0700 Subject: [PATCH] Added volatile message tests for htmlfile. --- test/transports.htmlfile.test.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/transports.htmlfile.test.js b/test/transports.htmlfile.test.js index d2335d0b..cd246ea2 100644 --- a/test/transports.htmlfile.test.js +++ b/test/transports.htmlfile.test.js @@ -307,6 +307,38 @@ module.exports = { }, 10); }, 10); }); + }, + + 'test sending deliverable volatile messages': function (done) { + var port = ++ports + , cl = client(port) + , io = create(cl) + , messaged = false; + + io.configure(function () { + io.set('close timeout', 0); + }); + + io.sockets.on('connection', function (socket) { + socket.volatile.send('woot'); + + socket.on('disconnect', function () { + io.server.close(); + done(); + }); + }); + + cl.handshake(function (sid) { + cl.data('/socket.io/{protocol}/htmlfile/' + sid, function (msgs) { + msgs.should.have.length(1); + msgs[0].should.eql({ + type: 'message' + , data: 'woot' + , endpoint: '' + }); + cl.end(); + }); + }); } };