@@ -10,7 +10,7 @@ const [port1, port2, port3] = require('../ports-map').ClientOptions;
10
10
const { beforeBrowserCloseDelay } = require ( '../helpers/puppeteer-constants' ) ;
11
11
12
12
describe ( 'Client code' , ( ) => {
13
- function startProxy ( port ) {
13
+ function startProxy ( port , cb ) {
14
14
const proxy = express ( ) ;
15
15
proxy . use (
16
16
'/' ,
@@ -20,7 +20,7 @@ describe('Client code', () => {
20
20
changeOrigin : true ,
21
21
} )
22
22
) ;
23
- return proxy . listen ( port ) ;
23
+ return proxy . listen ( port , cb ) ;
24
24
}
25
25
26
26
beforeAll ( ( done ) => {
@@ -45,8 +45,8 @@ describe('Client code', () => {
45
45
describe ( 'behind a proxy' , ( ) => {
46
46
let proxy ;
47
47
48
- beforeAll ( ( ) => {
49
- proxy = startProxy ( port2 ) ;
48
+ beforeAll ( ( done ) => {
49
+ proxy = startProxy ( port2 , done ) ;
50
50
} ) ;
51
51
52
52
afterAll ( ( done ) => {
@@ -55,15 +55,14 @@ describe('Client code', () => {
55
55
} ) ;
56
56
} ) ;
57
57
58
- it ( 'responds with a 200' , ( done ) => {
59
- {
60
- const req = request ( `http://localhost:${ port2 } ` ) ;
61
- req . get ( '/sockjs-node' ) . expect ( 200 , 'Welcome to SockJS!\n' , done ) ;
62
- }
63
- {
64
- const req = request ( `http://localhost:${ port1 } ` ) ;
65
- req . get ( '/sockjs-node' ) . expect ( 200 , 'Welcome to SockJS!\n' , done ) ;
66
- }
58
+ it ( 'responds with a 200 on proxy port' , ( done ) => {
59
+ const req = request ( `http://localhost:${ port2 } ` ) ;
60
+ req . get ( '/sockjs-node' ) . expect ( 200 , 'Welcome to SockJS!\n' , done ) ;
61
+ } ) ;
62
+
63
+ it ( 'responds with a 200 on non-proxy port' , ( done ) => {
64
+ const req = request ( `http://localhost:${ port1 } ` ) ;
65
+ req . get ( '/sockjs-node' ) . expect ( 200 , 'Welcome to SockJS!\n' , done ) ;
67
66
} ) ;
68
67
69
68
it ( 'requests websocket through the proxy with proper port number' , ( done ) => {
0 commit comments