Skip to content

Commit ddeb713

Browse files
committed
tests: add maxAge option tests for res.sendFile
1 parent 7154014 commit ddeb713

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/res.sendFile.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,30 @@ describe('res', function(){
180180
});
181181
});
182182

183+
describe('with "maxAge" option', function () {
184+
it('should set cache-control max-age from number', function (done) {
185+
var app = createApp(path.resolve(__dirname, 'fixtures/name.txt'), {
186+
maxAge: 14400000
187+
})
188+
189+
request(app)
190+
.get('/')
191+
.expect('Cache-Control', 'public, max-age=14400')
192+
.expect(200, done)
193+
})
194+
195+
it('should set cache-control max-age from string', function (done) {
196+
var app = createApp(path.resolve(__dirname, 'fixtures/name.txt'), {
197+
maxAge: '4h'
198+
})
199+
200+
request(app)
201+
.get('/')
202+
.expect('Cache-Control', 'public, max-age=14400')
203+
.expect(200, done)
204+
})
205+
})
206+
183207
describe('with "root" option', function () {
184208
it('should not transfer relative with without', function (done) {
185209
var app = createApp('test/fixtures/name.txt');

0 commit comments

Comments
 (0)