Permalink
Browse files

add directory() json test

  • Loading branch information...
1 parent 7c4b267 commit 1db066522e2a4408a2da634d519b0468243ef0c2 TJ Holowaychuk committed Dec 6, 2012
Showing with 16 additions and 7 deletions.
  1. +16 −7 test/directory.js
View
@@ -1,19 +1,28 @@
var connect = require('..');
+var app = connect();
+app.use(connect.directory('.'));
+
describe('directory()', function(){
- describe('when Accept: application/json is given', function(done){
- it('should respond with json', function(){
-
+ describe('when Accept: application/json is given', function(){
+ it('should respond with json', function(done){
+ app.request()
+ .get('/')
+ .set('Accept', 'application/json')
+ .end(function(res){
+ var arr = JSON.parse(res.body);
+ arr.should.include('lib');
+ arr.should.include('node_modules');
+ arr.should.include('docs');
+ arr.should.include('Readme.md');
+ done();
+ });
})
})
describe('when Accept: text/html is given', function(){
it('should respond with json', function(done){
- var app = connect();
-
- app.use(connect.directory('.'));
-
app.request()
.get('/')
.set('Accept', 'text/html')

0 comments on commit 1db0665

Please sign in to comment.