Skip to content

Commit 8c39ef7

Browse files
asambstackfrancisf
authored andcommitted
chore: add tests for socket close
1 parent d100a15 commit 8c39ef7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/core/incomingWebSocket.test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,17 @@ describe('IncomingWebSocket', () => {
137137

138138
describe('#close', () => {
139139
let terminateSpy;
140+
let closeSpy;
140141
before(() => {
141142
terminateSpy = spy();
143+
closeSpy = spy();
142144
incomingWs.socket.terminate = terminateSpy;
143-
incomingWs.close();
145+
incomingWs.socket.close = closeSpy;
146+
incomingWs.close(1001, 'msg');
147+
});
148+
149+
it('should close the websocket', () => {
150+
assert(closeSpy.calledWith(1001, 'msg'));
144151
});
145152

146153
it('should terminate the websocket', () => {

0 commit comments

Comments
 (0)