Permalink
Browse files

Added test for static middleware. I don't think .request() works the …

…same as a real browser, since safari/chrome/ff all timeout on certain static files.
  • Loading branch information...
Hunter Loftis
Hunter Loftis committed Mar 4, 2012
1 parent 7d168f5 commit e7b746f3f0abfc2fb971a6f53d8a2fba9b2252cb
Showing with 22 additions and 0 deletions.
  1. BIN test/fixtures/favicon.ico
  2. +22 −0 test/timeout.js
View
Binary file not shown.
View
@@ -1,13 +1,22 @@
var connect = require('../');
+var fixtures = __dirname + '/fixtures';
+
var app = connect();
app.use(connect.timeout({
code: 503,
time: 500
}));
+app.use(connect['static'](fixtures));
+
+var timeouts;
+app.use(function(err, req, res, next) {
+ timeouts++;
+});
+
app.use(function(req, res, next) {
if (req.url === '/should/timeout') {
// chill and wait for timeout
@@ -54,4 +63,17 @@ describe('connect.timeout()', function() {
done();
});
});
+
+ it('should serve static files without timeout', function(done){
+ timeouts = 0;
+ app.request()
+ .get('/favicon.ico')
+ .end(function(res) {
+ setTimeout(function() {
+ timeouts.should.equal(0);
+ done();
+ }, 1000);
+ });
+ });
+
});

0 comments on commit e7b746f

Please sign in to comment.