Skip to content

Commit

Permalink
[test] Simplify test
Browse files Browse the repository at this point in the history
  • Loading branch information
lpinca committed Jan 30, 2022
1 parent 33fd101 commit 8a7016d
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions test/websocket.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2757,18 +2757,17 @@ describe('WebSocket', () => {
requestCert: true
});

let success = false;
const wss = new WebSocket.Server({
verifyClient: (info) => {
success = !!info.req.client.authorized;
return true;
},
server
});
const wss = new WebSocket.Server({ noServer: true });

wss.on('connection', () => {
assert.ok(success);
server.close(done);
server.on('upgrade', (request, socket, head) => {
assert.ok(socket.authorized);

wss.handleUpgrade(request, socket, head, (ws) => {
ws.on('close', (code) => {
assert.strictEqual(code, 1005);
server.close(done);
});
});
});

server.listen(0, () => {
Expand Down

0 comments on commit 8a7016d

Please sign in to comment.