Skip to content

Commit

Permalink
tests: add maxAge option tests for res.sendFile
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Sep 28, 2017
1 parent 7154014 commit ddeb713
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/res.sendFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,30 @@ describe('res', function(){
});
});

describe('with "maxAge" option', function () {
it('should set cache-control max-age from number', function (done) {
var app = createApp(path.resolve(__dirname, 'fixtures/name.txt'), {
maxAge: 14400000
})

request(app)
.get('/')
.expect('Cache-Control', 'public, max-age=14400')
.expect(200, done)
})

it('should set cache-control max-age from string', function (done) {
var app = createApp(path.resolve(__dirname, 'fixtures/name.txt'), {
maxAge: '4h'
})

request(app)
.get('/')
.expect('Cache-Control', 'public, max-age=14400')
.expect(200, done)
})
})

describe('with "root" option', function () {
it('should not transfer relative with without', function (done) {
var app = createApp('test/fixtures/name.txt');
Expand Down

0 comments on commit ddeb713

Please sign in to comment.