@@ -7,6 +7,7 @@ import { Server } from "..";
7
7
import { io as ioc , Socket as ClientSocket } from "socket.io-client" ;
8
8
import request from "supertest" ;
9
9
import expect from "expect.js" ;
10
+ import { assert } from "./support/util" ;
10
11
11
12
const createPartialDone = ( done : ( err ?: Error ) => void , count : number ) => {
12
13
let i = 0 ;
@@ -134,6 +135,8 @@ describe("socket.io with uWebSocket.js-based engine", () => {
134
135
clientWSOnly . on ( "hello" , partialDone ) ;
135
136
clientPollingOnly . on ( "hello" , partialDone ) ;
136
137
clientCustomNamespace . on ( "hello" , shouldNotHappen ( done ) ) ;
138
+ assert ( clientWSOnly . id ) ;
139
+ assert ( clientPollingOnly . id ) ;
137
140
138
141
io . of ( "/" ) . sockets . get ( clientWSOnly . id ) ! . join ( "room1" ) ;
139
142
io . of ( "/" ) . sockets . get ( clientPollingOnly . id ) ! . join ( "room1" ) ;
@@ -148,6 +151,8 @@ describe("socket.io with uWebSocket.js-based engine", () => {
148
151
clientWSOnly . on ( "hello" , partialDone ) ;
149
152
clientPollingOnly . on ( "hello" , partialDone ) ;
150
153
clientCustomNamespace . on ( "hello" , shouldNotHappen ( done ) ) ;
154
+ assert ( clientWSOnly . id ) ;
155
+ assert ( clientPollingOnly . id ) ;
151
156
152
157
io . of ( "/" ) . sockets . get ( clientWSOnly . id ) ! . join ( "room1" ) ;
153
158
io . of ( "/" ) . sockets . get ( clientPollingOnly . id ) ! . join ( "room2" ) ;
@@ -163,6 +168,8 @@ describe("socket.io with uWebSocket.js-based engine", () => {
163
168
clientPollingOnly . on ( "hello" , shouldNotHappen ( done ) ) ;
164
169
clientCustomNamespace . on ( "hello" , shouldNotHappen ( done ) ) ;
165
170
171
+ assert ( clientWSOnly . id ) ;
172
+ assert ( clientPollingOnly . id ) ;
166
173
io . of ( "/" ) . sockets . get ( clientWSOnly . id ) ! . join ( "room1" ) ;
167
174
io . of ( "/" ) . sockets . get ( clientPollingOnly . id ) ! . join ( "room2" ) ;
168
175
@@ -177,6 +184,9 @@ describe("socket.io with uWebSocket.js-based engine", () => {
177
184
clientPollingOnly . on ( "hello" , partialDone ) ;
178
185
clientCustomNamespace . on ( "hello" , shouldNotHappen ( done ) ) ;
179
186
187
+ assert ( client . id ) ;
188
+ assert ( clientWSOnly . id ) ;
189
+ assert ( clientPollingOnly . id ) ;
180
190
io . of ( "/" ) . sockets . get ( client . id ) ! . join ( "room1" ) ;
181
191
io . of ( "/" ) . sockets . get ( clientPollingOnly . id ) ! . join ( "room1" ) ;
182
192
@@ -189,6 +199,7 @@ describe("socket.io with uWebSocket.js-based engine", () => {
189
199
it ( "should not crash when socket is disconnected before the upgrade" , ( done ) => {
190
200
client . on ( "disconnect" , ( ) => done ( ) ) ;
191
201
202
+ assert ( client . id ) ;
192
203
io . of ( "/" ) . sockets . get ( client . id ) ! . disconnect ( ) ;
193
204
} ) ;
194
205
0 commit comments