Skip to content

Commit

Permalink
Added tests for the server management (v2)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed Jun 26, 2017
1 parent f5b48a7 commit 735e2ed
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/v2/tests.ts/server/startAndStop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Test } from '../Type'
import { v2 } from '../../../../lib/index.js'
import * as request from 'request'

export default ((info, isValid) =>
{
const server = info.init(1);
const server2 = info.startServer({}, false);

server.stop(() => {
server2.start(info.port + 4, (httpServer) => {
if(httpServer.address().port !== info.port + 4)
return isValid(false, 'Wrong port');

server2.stop(() => {
server2.start((httpServer) => {
isValid(httpServer.address().port === info.port + 1, 'Wrong port');
});
})
});
});
}) as Test;

0 comments on commit 735e2ed

Please sign in to comment.