tests: add test for res.sendFile "cacheContol" option

closes #3061
This commit is contained in:
Zachary Lester 2016-08-23 13:36:52 -07:00 committed by Douglas Christopher Wilson
parent d1d9631b97
commit 6723b4419a

View File

@ -116,6 +116,26 @@ describe('res', function(){
test.expect(200, cb);
})
describe('with "cacheControl" option', function () {
it('should enable cacheControl by default', function (done) {
var app = createApp(path.resolve(__dirname, 'fixtures/name.txt'))
request(app)
.get('/')
.expect('Cache-Control', 'public, max-age=0')
.expect(200, done)
})
it('should accept cacheControl option', function (done) {
var app = createApp(path.resolve(__dirname, 'fixtures/name.txt'), { cacheControl: false })
request(app)
.get('/')
.expect(utils.shouldNotHaveHeader('Cache-Control'))
.expect(200, done)
})
})
describe('with "dotfiles" option', function () {
it('should not serve dotfiles by default', function (done) {
var app = createApp(path.resolve(__dirname, 'fixtures/.name'));