Skip to content

Commit

Permalink
Added the 'date' header test
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed May 22, 2017
1 parent 76f3340 commit 5668628
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/tests/date.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var webdav = require('../../lib/index.js'),
request = require('request');

module.exports = (test, options, index) => test('date', isValid =>
{
var server = new webdav.WebDAVServer();
server.start(options.port + index);
isValid = isValid.multiple(1, server);
const _ = (e, cb) => {
if(e)
isValid(false, e);
else
cb();
}

request({
url: 'http://localhost:' + (options.port + index) + '/',
method: 'OPTIONS'
}, (e, res, body) => _(e, () => {
isValid(Object.keys(res.headers).some(n => n.toLowerCase() === 'date'), 'The \'date\' header is missing in the response')
}));
})

0 comments on commit 5668628

Please sign in to comment.