test: Run tests on different ports.

This commit is contained in:
Ruben Verborgh 2020-11-20 15:51:13 +01:00
parent 59487410b1
commit 97d7e4657b

View File

@ -33,7 +33,7 @@ describe('SimpleWebSocketHandler', (): void => {
webSocketHandler = new SimpleWebSocketHandler();
const httpServerFactory = new ExpressHttpServerFactory(httpHandler);
const webSocketServerFactory = new WebSocketServerFactory(httpServerFactory, webSocketHandler);
server = webSocketServerFactory.startServer(5555);
server = webSocketServerFactory.startServer(5556);
});
afterAll(async(): Promise<void> => {
@ -46,9 +46,9 @@ describe('SimpleWebSocketHandler', (): void => {
});
it('has a functioning WebSockets interface.', async(): Promise<void> => {
const client = new WebSocket('ws://localhost:5555');
const client = new WebSocket('ws://localhost:5556');
const text = await new Promise((resolve): any => client.on('message', resolve));
expect(text).toBe('SimpleWebSocketHandler');
expect(webSocketHandler.host).toBe('localhost:5555');
expect(webSocketHandler.host).toBe('localhost:5556');
});
});