Skip to content

Commit

Permalink
Added more tests for the start method
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed May 24, 2017
1 parent 4313cba commit 516a7fb
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions test/tests/createServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ var webdav = require('../../lib/index.js');

module.exports = (test, options, index) => test('create server', isValid =>
{
var server = new webdav.WebDAVServer();
server.start(options.port + index);
var server = new webdav.WebDAVServer({
port: options.port + index
});
isValid = isValid.multiple(1, server);

server.stop(() => {
isValid(true);
})
server.start(options.port + index, (httpServer) => {
if(httpServer.address().port !== options.port + index)
{
isValid(false, 'Wrong port');
return;
}

server.stop(() => {
server.start((httpServer) => {
isValid(httpServer.address().port === options.port + index, 'Wrong port');
});
})
});
})

0 comments on commit 516a7fb

Please sign in to comment.