@@ -105,12 +105,7 @@ describe('.onmessage', () => {
105
105
encoder . writer . buf ( Buffer . from ( [ 0x04 , 0x05 , 0x06 ] ) , 3 ) ;
106
106
const payload2 = encoder . writer . flush ( ) ;
107
107
socket . write ( pingFrame ) ;
108
- socket . write ( listToUint8 ( [
109
- frame1 ,
110
- payload1 ,
111
- frame2 ,
112
- payload2 ,
113
- ] ) ) ;
108
+ socket . write ( listToUint8 ( [ frame1 , payload1 , frame2 , payload2 ] ) ) ;
114
109
await until ( ( ) => messages . length === 2 ) ;
115
110
expect ( messages [ 0 ] ) . toEqual ( [ new Uint8Array ( [ 0x01 , 0x02 , 0x03 ] ) , false ] ) ;
116
111
expect ( messages [ 1 ] ) . toEqual ( [ new Uint8Array ( [ 0x04 , 0x05 , 0x06 ] ) , false ] ) ;
@@ -135,18 +130,13 @@ describe('.onmessage', () => {
135
130
encoder . writer . buf ( Buffer . from ( [ 0x04 , 0x05 , 0x06 , 0x07 ] ) , 4 ) ;
136
131
const payload2 = encoder . writer . flush ( ) ;
137
132
socket . write ( pingFrame ) ;
138
- socket . write ( listToUint8 ( [
139
- frame1 ,
140
- payload1 ,
141
- frame2 ,
142
- payload2 ,
143
- ] ) ) ;
133
+ socket . write ( listToUint8 ( [ frame1 , payload1 , frame2 , payload2 ] ) ) ;
144
134
await until ( ( ) => messages . length === 1 ) ;
145
135
await until ( ( ) => closes . length === 1 ) ;
146
136
expect ( messages [ 0 ] ) . toEqual ( [ new Uint8Array ( [ 0x01 , 0x02 , 0x03 ] ) , false ] ) ;
147
137
expect ( closes [ 0 ] ) . toEqual ( [ 1009 , 'TOO_LARGE' ] ) ;
148
138
} ) ;
149
-
139
+
150
140
test ( 'text frame' , async ( ) => {
151
141
const { socket, encoder, connection} = setup ( ) ;
152
142
const messages : [ data : Uint8Array , isUtf8 : boolean ] [ ] = [ ] ;
@@ -184,7 +174,7 @@ describe('.onmessage', () => {
184
174
await until ( ( ) => messages . length === 1 ) ;
185
175
expect ( messages [ 0 ] ) . toEqual ( [ new Uint8Array ( [ 0x01 , 0x02 , 0x03 ] ) , false ] ) ;
186
176
} ) ;
187
-
177
+
188
178
test ( 'text frame' , async ( ) => {
189
179
const { socket, encoder, connection} = setup ( ) ;
190
180
const messages : [ data : Uint8Array , isUtf8 : boolean ] [ ] = [ ] ;
@@ -263,9 +253,7 @@ describe('.onfragment', () => {
263
253
socket . write ( buf5 ) ;
264
254
socket . write ( buf6 ) ;
265
255
await until ( ( ) => messages . length === 1 ) ;
266
- expect ( messages ) . toEqual ( [
267
- [ new Uint8Array ( [ 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 , 0x09 ] ) , false ] ,
268
- ] ) ;
256
+ expect ( messages ) . toEqual ( [ [ new Uint8Array ( [ 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 , 0x09 ] ) , false ] ] ) ;
269
257
} ) ;
270
258
271
259
test ( 'errors out when incoming message is too large' , async ( ) => {
@@ -293,9 +281,7 @@ describe('.onfragment', () => {
293
281
socket . write ( buf5 ) ;
294
282
socket . write ( buf6 ) ;
295
283
await until ( ( ) => closes . length === 1 ) ;
296
- expect ( closes ) . toEqual ( [
297
- [ 1009 , 'TOO_LARGE' ] ,
298
- ] ) ;
284
+ expect ( closes ) . toEqual ( [ [ 1009 , 'TOO_LARGE' ] ] ) ;
299
285
} ) ;
300
286
} ) ;
301
287
} ) ;
0 commit comments