Skip to content
Browse files

Added gitignore

Added coverage testing to Makefile
Added heartbeat test to multipart
  • Loading branch information...
1 parent 3ecb37d commit a65326e640bef488777fbdd5db048038d62f702a @rauchg rauchg committed Oct 24, 2010
Showing with 40 additions and 0 deletions.
  1. +8 −0 .gitignore
  2. +3 −0 Makefile
  3. +29 −0 tests/transports.xhr-multipart.js
View
8 .gitignore
@@ -0,0 +1,8 @@
+.DS_Store
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
View
3 Makefile
@@ -1,5 +1,8 @@
test:
./support/expresso/bin/expresso -I lib $(TESTFLAGS) tests/*.js
+
+test-cov:
+ @TESTFLAGS=--cov $(MAKE) test
example:
node ./example/server.js
View
29 tests/transports.xhr-multipart.js
@@ -180,6 +180,35 @@ module.exports = {
});
});
});
+ },
+
+ 'test hearbeat timeout': function(assert){
+ var _server = server()
+ , _socket = socket(_server, {
+ transportOptions: {
+ 'xhr-multipart': {
+ timeout: 100,
+ heartbeatInterval: 1
+ }
+ }
+ });
+ listen(_server, function(){
+ var client = get(_server, '/socket.io/xhr-multipart', function(response){
+ var messages = 0;
+ response.on('data', function(data){
+ ++messages;
+ var msg = decode(data);
+ if (data.substr(0, 3) == '~h~'){
+ assert.ok(messages == 2);
+ assert.ok(Object.keys(_socket.clients).length == 1);
+ setTimeout(function(){
+ console.log('test');
+ assert.ok(Object.keys(_socket.clients).length == 0);
+ }, 150);
+ }
+ });
+ });
+ });
}
};

0 comments on commit a65326e

Please sign in to comment.
Something went wrong with that request. Please try again.