@@ -72,7 +72,7 @@ async function createDialog(
7272
7373 let client = new Client < object , TestLog > ( {
7474 server : pair . left ,
75- subprotocol : '1.0.0' ,
75+ subprotocol : 10 ,
7676 time : new TestTime ( ) ,
7777 userId : '10' ,
7878 ...opts
@@ -114,7 +114,7 @@ async function createDialog(
114114function createClient ( ) : Client < object , TestLog > {
115115 let client = new Client < object , TestLog > ( {
116116 server : 'wss://localhost:1337' ,
117- subprotocol : '1.0.0' ,
117+ subprotocol : 10 ,
118118 time : new TestTime ( ) ,
119119 userId : '10'
120120 } )
@@ -126,16 +126,16 @@ function createClient(): Client<object, TestLog> {
126126it ( 'saves options' , ( ) => {
127127 let client = new Client ( {
128128 server : 'wss://localhost:1337' ,
129- subprotocol : '1.0.0' ,
129+ subprotocol : 10 ,
130130 userId : '10'
131131 } )
132- expect ( client . options . subprotocol ) . toBe ( '1.0.0' )
132+ expect ( client . options . subprotocol ) . toBe ( 10 )
133133} )
134134
135135it ( 'throws on missed server' , ( ) => {
136136 expect ( ( ) => {
137137 // @ts -expect-error
138- new Client ( { subprotocol : '1.0.0' , userId : '10' } )
138+ new Client ( { subprotocol : 10 , userId : '10' } )
139139 } ) . toThrow ( / s e r v e r / )
140140} )
141141
@@ -149,15 +149,15 @@ it('throws on missed subprotocol', () => {
149149it ( 'throws on missed user ID' , ( ) => {
150150 expect ( ( ) => {
151151 // @ts -expect-error
152- new Client ( { server : 'wss://localhost:1337' , subprotocol : '1.0.0' } )
152+ new Client ( { server : 'wss://localhost:1337' , subprotocol : 10 } )
153153 } ) . toThrow ( / u s e r I d / )
154154} )
155155
156156it ( 'throws on colon in user ID' , ( ) => {
157157 expect ( ( ) => {
158158 new Client ( {
159159 server : 'wss://localhost:1337' ,
160- subprotocol : '1.0.0' ,
160+ subprotocol : 10 ,
161161 userId : 'admin:1'
162162 } )
163163 } ) . toThrow ( / c o l o n / )
@@ -167,7 +167,7 @@ it('throws on false in user ID', () => {
167167 expect ( ( ) => {
168168 new Client ( {
169169 server : 'wss://localhost:1337' ,
170- subprotocol : '1.0.0' ,
170+ subprotocol : 10 ,
171171 // @ts -expect-error
172172 userId : false
173173 } )
@@ -178,7 +178,7 @@ it('throws on non-string in user ID', () => {
178178 expect ( ( ) => {
179179 new Client ( {
180180 server : 'wss://localhost:1337' ,
181- subprotocol : '1.0.0' ,
181+ subprotocol : 10 ,
182182 // @ts -expect-error
183183 userId : 10
184184 } )
@@ -230,7 +230,7 @@ it('ignores WS in development', async () => {
230230it ( 'uses user ID in node ID' , ( ) => {
231231 let client1 = new Client ( {
232232 server : 'wss://localhost:1337' ,
233- subprotocol : '1.0.0' ,
233+ subprotocol : 10 ,
234234 userId : '10'
235235 } )
236236 expect ( client1 . clientId ) . toMatch ( / ^ 1 0 : [ \w - ] { 8 } $ / )
@@ -239,7 +239,7 @@ it('uses user ID in node ID', () => {
239239
240240 let client2 = new Client ( {
241241 server : 'wss://localhost:1337' ,
242- subprotocol : '1.0.0' ,
242+ subprotocol : 10 ,
243243 userId : '10'
244244 } )
245245 expect ( client2 . nodeId ) . toEqual ( client2 . clientId + ':' + client2 . tabId )
@@ -248,7 +248,7 @@ it('uses user ID in node ID', () => {
248248it ( 'uses node ID in ID generator' , ( ) => {
249249 let client = new Client ( {
250250 server : 'wss://localhost:1337' ,
251- subprotocol : '1.0.0' ,
251+ subprotocol : 10 ,
252252 time : new TestTime ( ) ,
253253 userId : '10'
254254 } )
@@ -261,7 +261,7 @@ it('uses custom store', () => {
261261 let client = new Client ( {
262262 server : 'wss://localhost:1337' ,
263263 store,
264- subprotocol : '1.0.0' ,
264+ subprotocol : 10 ,
265265 userId : '10'
266266 } )
267267 expect ( client . log . store ) . toBe ( store )
@@ -273,7 +273,7 @@ it('sends options to connection', () => {
273273 maxDelay : 500 ,
274274 minDelay : 100 ,
275275 server : 'wss://localhost:1337' ,
276- subprotocol : '1.0.0' ,
276+ subprotocol : 10 ,
277277 userId : '10'
278278 } )
279279 expect ( privateMethods ( client . node . connection ) . options ) . toEqual ( {
@@ -290,12 +290,12 @@ it('sends options to node', () => {
290290 let client = new Client ( {
291291 ping : 1000 ,
292292 server : 'wss://localhost:1337' ,
293- subprotocol : '1.0.0' ,
293+ subprotocol : 10 ,
294294 timeout : 2000 ,
295295 token : 'token' ,
296296 userId : '10'
297297 } )
298- expect ( client . node . options . subprotocol ) . toBe ( '1.0.0' )
298+ expect ( client . node . options . subprotocol ) . toBe ( 10 )
299299 expect ( client . node . options . token ) . toBe ( 'token' )
300300 expect ( client . node . options . timeout ) . toBe ( 2000 )
301301 expect ( client . node . options . ping ) . toBe ( 1000 )
@@ -407,7 +407,7 @@ it('cleans other tab action after timeout', async () => {
407407it ( 'adds current subprotocol to meta' , async ( ) => {
408408 let client = createClient ( )
409409 await client . log . add ( { type : 'A' } , { reasons : [ 'test' ] } )
410- expect ( client . log . entries ( ) [ 0 ] [ 1 ] . subprotocol ) . toBe ( '1.0.0' )
410+ expect ( client . log . entries ( ) [ 0 ] [ 1 ] . subprotocol ) . toBe ( 10 )
411411} )
412412
413413it ( 'adds current subprotocol only to own actions' , async ( ) => {
@@ -421,11 +421,8 @@ it('adds current subprotocol only to own actions', async () => {
421421
422422it ( 'allows to override subprotocol in meta' , async ( ) => {
423423 let client = createClient ( )
424- await client . log . add (
425- { type : 'A' } ,
426- { reasons : [ 'test' ] , subprotocol : '0.1.0' }
427- )
428- expect ( client . log . entries ( ) [ 0 ] [ 1 ] . subprotocol ) . toBe ( '0.1.0' )
424+ await client . log . add ( { type : 'A' } , { reasons : [ 'test' ] , subprotocol : 9 } )
425+ expect ( client . log . entries ( ) [ 0 ] [ 1 ] . subprotocol ) . toBe ( 9 )
429426} )
430427
431428it ( 'sends only special actions' , async ( ) => {
@@ -490,7 +487,7 @@ it('compresses subprotocol', async () => {
490487 {
491488 id : '1 10:client:id 0' ,
492489 reasons : [ 'test' ] ,
493- subprotocol : '1.0.0' ,
490+ subprotocol : 10 ,
494491 sync : true
495492 }
496493 ) ,
@@ -499,7 +496,7 @@ it('compresses subprotocol', async () => {
499496 {
500497 id : '2 10:client:id 0' ,
501498 reasons : [ 'test' ] ,
502- subprotocol : '2.0.0' ,
499+ subprotocol : 11 ,
503500 sync : true
504501 }
505502 )
@@ -516,7 +513,7 @@ it('compresses subprotocol', async () => {
516513 { type : 'a' } ,
517514 {
518515 id : [ 2 , '10:client:id' , 0 ] ,
519- subprotocol : '2.0.0' ,
516+ subprotocol : 11 ,
520517 time : 2
521518 }
522519 ]
@@ -885,13 +882,7 @@ it('works with unsubscribe in offline', async () => {
885882 await delay ( 10 )
886883
887884 expect ( pair . leftSent ) . toEqual ( [
888- [
889- 'connect' ,
890- client . node . localProtocol ,
891- '10:1:1' ,
892- 0 ,
893- { subprotocol : '1.0.0' }
894- ] ,
885+ [ 'connect' , client . node . localProtocol , '10:1:1' , 0 , { subprotocol : 10 } ] ,
895886 [
896887 'sync' ,
897888 3 ,
0 commit comments