Skip to content

Commit 516a7fb

Browse files
committed
Added more tests for the start method
1 parent 4313cba commit 516a7fb

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

test/tests/createServer.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@ var webdav = require('../../lib/index.js');
33

44
module.exports = (test, options, index) => test('create server', isValid =>
55
{
6-
var server = new webdav.WebDAVServer();
7-
server.start(options.port + index);
6+
var server = new webdav.WebDAVServer({
7+
port: options.port + index
8+
});
9+
isValid = isValid.multiple(1, server);
810

9-
server.stop(() => {
10-
isValid(true);
11-
})
11+
server.start(options.port + index, (httpServer) => {
12+
if(httpServer.address().port !== options.port + index)
13+
{
14+
isValid(false, 'Wrong port');
15+
return;
16+
}
17+
18+
server.stop(() => {
19+
server.start((httpServer) => {
20+
isValid(httpServer.address().port === options.port + index, 'Wrong port');
21+
});
22+
})
23+
});
1224
})

0 commit comments

Comments
 (0)