Skip to content

Commit 4a2b873

Browse files
author
ionut.stan
committed
Improved testing.
1 parent b8faa89 commit 4a2b873

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

tests/AllTests.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class AllTests
7676
this._serverAuthorizeAllPlugin = new JSONRPC.Plugins.Server.AuthorizeAll();
7777

7878
this._bWebSocketMode = !!bWebSocketMode;
79+
this._bPreventHTTPAPIRequests = false;
7980

8081
Object.seal(this);
8182
}
@@ -86,6 +87,9 @@ class AllTests
8687
*/
8788
async runTests()
8889
{
90+
this._bPreventHTTPAPIRequests = this._bWebSocketMode;
91+
92+
8993
await this.triggerConnectionRefused();
9094

9195

@@ -233,7 +237,7 @@ class AllTests
233237
return;
234238
}
235239
else if(
236-
this._bWebSocketMode
240+
this._bPreventHTTPAPIRequests
237241
&& !incomingRequest.headers["sec-websocket-version"]
238242
&& incomingRequest.method === "POST"
239243
&& url.parse(incomingRequest.url).pathname.substr(0, 4) === "/api"
@@ -510,8 +514,7 @@ class AllTests
510514
*/
511515
async endpointNotFoundError()
512516
{
513-
const bWebSocketMode = this._bWebSocketMode;
514-
this._bWebSocketMode = false;
517+
this._bPreventHTTPAPIRequests = false;
515518

516519

517520
console.log("[" + process.pid + "] endpointNotFoundError");
@@ -538,7 +541,7 @@ class AllTests
538541
}
539542

540543

541-
this._bWebSocketMode = bWebSocketMode;
544+
this._bPreventHTTPAPIRequests = this._bWebSocketMode;
542545
}
543546

544547

tests/Browser/main_server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ process.on(
2020
await allTests.setupWebsocketServerSiteA();
2121
await allTests.disableServerSecuritySiteA();
2222

23-
console.log("Go to http://localhost:8324/tests/Browser/index.html");
23+
console.log("Go to http://localhost:8324/tests/Browser/index.html?websocketmode=1");
2424
}
2525
)();

0 commit comments

Comments
 (0)