From 05330827cc8fbf6f2d949ed356e74232a43fdf18 Mon Sep 17 00:00:00 2001 From: Adrien Castex Date: Sat, 13 May 2017 15:52:57 +0200 Subject: [PATCH] Added test for OPTIONS method --- test/tests/options.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/tests/options.js diff --git a/test/tests/options.js b/test/tests/options.js new file mode 100644 index 00000000..96c161a0 --- /dev/null +++ b/test/tests/options.js @@ -0,0 +1,16 @@ +var webdav = require('../../lib/index.js'), + request = require('request') + +module.exports = (test, options, index) => test('options method', isValid => +{ + var server = new webdav.WebDAVServer(); + server.start(options.port + index); + isValid = isValid.multiple(1, server); + + request({ + url: 'http://localhost:' + (options.port + index), + method: 'OPTIONS' + }, (e, res, body) => { + isValid(res.headers.allow && res.headers.allow.length >= 3 && /^[a-zA-Z,]+$/g.test(res.headers.allow)); + }) +}) \ No newline at end of file