Skip to content

Commit

Permalink
tests: add simple test for send.mime
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jan 23, 2016
1 parent 9460200 commit f840237
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions test/send.js
Expand Up @@ -31,12 +31,6 @@ var app = http.createServer(function(req, res){
.pipe(res);
});

describe('send.mime', function(){
it('should be exposed', function(){
assert(send.mime);
})
})

describe('send(file).pipe(res)', function(){
it('should stream the file contents', function(done){
request(app)
Expand Down Expand Up @@ -1290,6 +1284,31 @@ describe('send(file, options)', function(){
})
})

describe('send.mime', function () {
it('should be exposed', function () {
assert.ok(send.mime)
})

describe('.default_type', function () {
before(function () {
this.default_type = send.mime.default_type
})

afterEach(function () {
send.mime.default_type = this.default_type
})

it('should change the default type', function (done) {
send.mime.default_type = 'text/plain'

request(createServer({root: fixtures}))
.get('/nums')
.expect('Content-Type', 'text/plain; charset=UTF-8')
.expect(200, done)
})
})
})

function createServer(opts, fn) {
return http.createServer(function onRequest(req, res) {
try {
Expand Down

0 comments on commit f840237

Please sign in to comment.