@@ -11,6 +11,7 @@ import type * as ioNamespace from 'socket.io-client';
1111import { makeMove } from '../../core/action-creators' ;
1212import type { Master } from '../../master/master' ;
1313import type { ChatMessage , State } from '../../types' ;
14+ import { ProcessGameConfig } from '../../core/game' ;
1415
1516jest . mock ( '../../core/logger' , ( ) => ( {
1617 info : jest . fn ( ) ,
@@ -41,7 +42,11 @@ class MockSocket {
4142}
4243
4344test ( 'defaults' , ( ) => {
44- const m = new SocketIOTransport ( { transportDataCallback : ( ) => { } } ) ;
45+ const m = new SocketIOTransport ( {
46+ transportDataCallback : ( ) => { } ,
47+ game : ProcessGameConfig ( { } ) ,
48+ gameKey : { } ,
49+ } ) ;
4550 expect ( typeof ( m as any ) . connectionStatusCallback ) . toBe ( 'function' ) ;
4651 ( m as any ) . connectionStatusCallback ( ) ;
4752} ) ;
@@ -66,7 +71,12 @@ class TransportAdapter extends SocketIOTransport {
6671
6772describe ( 'update matchID / playerID / credentials' , ( ) => {
6873 const socket = new MockSocket ( ) ;
69- const m = new TransportAdapter ( { socket, transportDataCallback : ( ) => { } } ) ;
74+ const m = new TransportAdapter ( {
75+ socket,
76+ transportDataCallback : ( ) => { } ,
77+ game : ProcessGameConfig ( { } ) ,
78+ gameKey : { } ,
79+ } ) ;
7080
7181 beforeEach ( ( ) => ( socket . emit = jest . fn ( ) ) ) ;
7282
@@ -105,6 +115,8 @@ describe('connection status', () => {
105115 matchID : '0' ,
106116 playerID : '0' ,
107117 gameName : 'foo' ,
118+ game : ProcessGameConfig ( { } ) ,
119+ gameKey : { } ,
108120 numPlayers : 2 ,
109121 transportDataCallback : ( ) => { } ,
110122 } ) ;
@@ -133,7 +145,11 @@ describe('connection status', () => {
133145
134146 test ( 'doesn’t crash if syncing before connecting' , ( ) => {
135147 const transportDataCallback = jest . fn ( ) ;
136- const transport = new SocketIOTransport ( { transportDataCallback } ) ;
148+ const transport = new SocketIOTransport ( {
149+ transportDataCallback,
150+ game : ProcessGameConfig ( { } ) ,
151+ gameKey : { } ,
152+ } ) ;
137153 transport . requestSync ( ) ;
138154 expect ( transportDataCallback ) . not . toHaveBeenCalled ( ) ;
139155 } ) ;
@@ -145,6 +161,8 @@ describe('multiplayer', () => {
145161 const transport = new TransportAdapter ( {
146162 socket : mockSocket ,
147163 transportDataCallback,
164+ game : ProcessGameConfig ( { } ) ,
165+ gameKey : { } ,
148166 } ) ;
149167 transport . connect ( ) ;
150168
@@ -216,6 +234,8 @@ describe('multiplayer delta state', () => {
216234 const transport = new TransportAdapter ( {
217235 socket : mockSocket ,
218236 transportDataCallback,
237+ game : ProcessGameConfig ( { } ) ,
238+ gameKey : { } ,
219239 } ) ;
220240 transport . connect ( ) ;
221241
@@ -243,7 +263,12 @@ describe('server option', () => {
243263
244264 test ( 'without protocol' , ( ) => {
245265 const server = hostname + ':' + port ;
246- const m = new TransportAdapter ( { server, transportDataCallback : ( ) => { } } ) ;
266+ const m = new TransportAdapter ( {
267+ server,
268+ transportDataCallback : ( ) => { } ,
269+ game : ProcessGameConfig ( { } ) ,
270+ gameKey : { } ,
271+ } ) ;
247272 m . connect ( ) ;
248273 expect ( m . socket . io . engine . hostname ) . toEqual ( hostname ) ;
249274 expect ( m . socket . io . engine . port ) . toEqual ( port ) ;
@@ -255,6 +280,8 @@ describe('server option', () => {
255280 const m = new SocketIOTransport ( {
256281 server,
257282 transportDataCallback : ( ) => { } ,
283+ game : ProcessGameConfig ( { } ) ,
284+ gameKey : { } ,
258285 } ) ;
259286 m . connect ( ) ;
260287 expect ( ( m . socket . io as any ) . uri ) . toEqual ( server + '/default' ) ;
@@ -265,6 +292,8 @@ describe('server option', () => {
265292 const m = new TransportAdapter ( {
266293 server : serverWithProtocol ,
267294 transportDataCallback : ( ) => { } ,
295+ game : ProcessGameConfig ( { } ) ,
296+ gameKey : { } ,
268297 } ) ;
269298 m . connect ( ) ;
270299 expect ( m . socket . io . engine . hostname ) . toEqual ( hostname ) ;
@@ -277,6 +306,8 @@ describe('server option', () => {
277306 const m = new TransportAdapter ( {
278307 server : serverWithProtocol ,
279308 transportDataCallback : ( ) => { } ,
309+ game : ProcessGameConfig ( { } ) ,
310+ gameKey : { } ,
280311 } ) ;
281312 m . connect ( ) ;
282313 expect ( m . socket . io . engine . hostname ) . toEqual ( hostname ) ;
@@ -285,7 +316,11 @@ describe('server option', () => {
285316 } ) ;
286317
287318 test ( 'no server set' , ( ) => {
288- const m = new TransportAdapter ( { transportDataCallback : ( ) => { } } ) ;
319+ const m = new TransportAdapter ( {
320+ transportDataCallback : ( ) => { } ,
321+ game : ProcessGameConfig ( { } ) ,
322+ gameKey : { } ,
323+ } ) ;
289324 m . connect ( ) ;
290325 expect ( m . socket . io . engine . hostname ) . not . toEqual ( hostname ) ;
291326 expect ( m . socket . io . engine . port ) . not . toEqual ( port ) ;
0 commit comments