Permalink
Browse files

Added two tests. One to check for defaultContentType if it's set and …

…the other to verify content-type is application/octet-stream if default not set.
  • Loading branch information...
1 parent a30fc30 commit 715bcd8c9333b7d6acc36f57f79e85d15891c87f @jprichardson jprichardson committed Sep 20, 2012
Showing with 24 additions and 0 deletions.
  1. +24 −0 test/simple.js
View
@@ -120,6 +120,30 @@ describe('simple test', function() {
req.end();
});
+ it('serves the default content type specified in the options if it cant detect the mime', function(done) {
+ var dcPort = 42917
+ , dcBaseUrl = 'http://localhost:' + dcPort
+ , defaultType = 'text/crazy' //use something that we know doesn't exist
+ , handler = buffet(testFolder, {defaultContentType: defaultType})
+ ;
+
+ var server = http.createServer(handler).listen(dcPort, function() {
+ var req = http.get(dcBaseUrl + '/index', function(res) {
+ assert.equal(res.statusCode, 200);
+ assert.equal(res.headers['content-type'], defaultType);
+ server.close(done);
+ });
+ });
+ });
+
+ it('serves the application/octet-stream when no defaultContentType is and it cant detect the mime', function(done) {
+ var req = http.get(baseUrl + '/index', function(res) {
+ assert.equal(res.statusCode, 200);
+ assert.equal(res.headers['content-type'], 'application/octet-stream');
+ done();
+ });
+ });
+
describe('watcher', function() {
var testData = {yay: true}, folderName = idgen();
before(function(done) {

0 comments on commit 715bcd8

Please sign in to comment.