Permalink
Browse files

Prioritised default docs - initial tests

  • Loading branch information...
1 parent fb0d798 commit 5f6ce7c9bfb32f430b41b1682c07875640490966 @stoive committed Nov 22, 2011
Showing with 20 additions and 1 deletion.
  1. +20 −1 test/static.js
View
@@ -1,11 +1,13 @@
-
var connect = require('../');
var fixtures = __dirname + '/fixtures';
var app = connect();
app.use(connect.static(fixtures));
+var appDefaultsConfigured = connect();
+app.use(connect.static(fixtures, {defaults: ['todo.txt', 'index.html']}));
+
describe('connect.static()', function(){
it('should serve static files', function(done){
app.request()
@@ -42,6 +44,23 @@ describe('connect.static()', function(){
.get('/users')
.expect(301, done);
})
+
+ describe('When default documents are configured ', function(done) {
+ it('should redirect first preference when available', function(done) {
+ appDefaultsConfigured.request()
+ .get('/')
+ .expect('- groceries', done);
+ })
+
+ it('should fall back to latter preferences', function(done) {
+ appDefaultsConfigured.request()
+ .get('/users/')
+ .end(function(res){
+ res.body.should.equal('<p>tobi, loki, jane</p>');
+ done();
+ })
+ })
+ })
it('should support index.html', function(done){
app.request()

0 comments on commit 5f6ce7c

Please sign in to comment.