99import { createStore } from 'redux' ;
1010import { InitializeGame , CreateGameReducer } from '../core/reducer' ;
1111import { Client , createMoveDispatchers } from './client' ;
12+ import { Game } from '../core/game' ;
1213import { Local } from './transport/local' ;
1314import { SocketIO } from './transport/socketio' ;
1415import { update , sync , makeMove , gameEvent } from '../core/action-creators' ;
15- import Game from '../core/game' ;
1616import { RandomBot } from '../ai/bot' ;
1717import { error } from '../core/logger' ;
1818
@@ -23,11 +23,11 @@ jest.mock('../core/logger', () => ({
2323
2424test ( 'move api' , ( ) => {
2525 const client = Client ( {
26- game : Game ( {
26+ game : {
2727 moves : {
2828 A : ( G , ctx , arg ) => ( { arg } ) ,
2929 } ,
30- } ) ,
30+ } ,
3131 } ) ;
3232
3333 expect ( client . getState ( ) . G ) . toEqual ( { } ) ;
@@ -39,7 +39,7 @@ describe('namespaced moves', () => {
3939 let client ;
4040 beforeAll ( ( ) => {
4141 client = Client ( {
42- game : Game ( {
42+ game : {
4343 moves : {
4444 A : ( ) => 'A' ,
4545 } ,
@@ -52,7 +52,7 @@ describe('namespaced moves', () => {
5252 } ,
5353 } ,
5454 } ,
55- } ) ,
55+ } ,
5656 } ) ;
5757 } ) ;
5858
@@ -88,13 +88,13 @@ describe('namespaced moves', () => {
8888
8989test ( 'isActive' , ( ) => {
9090 const client = Client ( {
91- game : Game ( {
91+ game : {
9292 moves : {
9393 A : ( G , ctx , arg ) => ( { arg } ) ,
9494 } ,
9595
9696 endIf : G => G . arg == 42 ,
97- } ) ,
97+ } ,
9898 } ) ;
9999
100100 expect ( client . getState ( ) . G ) . toEqual ( { } ) ;
@@ -106,7 +106,7 @@ test('isActive', () => {
106106
107107describe ( 'step' , ( ) => {
108108 const client = Client ( {
109- game : Game ( {
109+ game : {
110110 setup : ( ) => ( { moved : false } ) ,
111111
112112 moves : {
@@ -118,7 +118,7 @@ describe('step', () => {
118118 endIf ( G ) {
119119 if ( G . moved ) return true ;
120120 } ,
121- } ) ,
121+ } ,
122122
123123 ai : {
124124 bot : RandomBot ,
@@ -134,7 +134,7 @@ describe('step', () => {
134134
135135 test ( 'does not crash on empty action' , ( ) => {
136136 const client = Client ( {
137- game : Game ( { } ) ,
137+ game : { } ,
138138
139139 ai : {
140140 bot : RandomBot ,
@@ -153,7 +153,7 @@ describe('multiplayer', () => {
153153
154154 beforeAll ( ( ) => {
155155 client = Client ( {
156- game : Game ( { moves : { A : ( ) => { } } } ) ,
156+ game : { moves : { A : ( ) => { } } } ,
157157 multiplayer : { server : host + ':' + port } ,
158158 } ) ;
159159 client . connect ( ) ;
@@ -185,7 +185,7 @@ describe('multiplayer', () => {
185185
186186 beforeAll ( ( ) => {
187187 client = Client ( {
188- game : Game ( { } ) ,
188+ game : { } ,
189189 multiplayer : true ,
190190 } ) ;
191191 client . connect ( ) ;
@@ -203,7 +203,7 @@ describe('multiplayer', () => {
203203
204204 beforeAll ( ( ) => {
205205 spec = {
206- game : Game ( { moves : { A : ( G , ctx ) => ( { A : ctx . playerID } ) } } ) ,
206+ game : { moves : { A : ( G , ctx ) => ( { A : ctx . playerID } ) } } ,
207207 multiplayer : { local : true } ,
208208 } ;
209209
@@ -255,7 +255,7 @@ describe('multiplayer', () => {
255255
256256 beforeAll ( ( ) => {
257257 client = Client ( {
258- game : Game ( { moves : { A : ( ) => { } } } ) ,
258+ game : { moves : { A : ( ) => { } } } ,
259259 multiplayer : { transport : CustomTransport } ,
260260 } ) ;
261261 } ) ;
@@ -274,7 +274,7 @@ describe('multiplayer', () => {
274274 describe ( 'invalid spec' , ( ) => {
275275 test ( 'logs error' , ( ) => {
276276 Client ( {
277- game : Game ( { moves : { A : ( ) => { } } } ) ,
277+ game : { moves : { A : ( ) => { } } } ,
278278 multiplayer : { blah : true } ,
279279 } ) ;
280280 expect ( error ) . toHaveBeenCalledWith ( 'invalid multiplayer spec' ) ;
@@ -292,11 +292,11 @@ test('accepts enhancer for store', () => {
292292 } ;
293293 } ;
294294 const client = Client ( {
295- game : Game ( {
295+ game : {
296296 moves : {
297297 A : ( G , ctx , arg ) => ( { arg } ) ,
298298 } ,
299- } ) ,
299+ } ,
300300 enhancer : spyEnhancer ,
301301 } ) ;
302302
@@ -307,7 +307,7 @@ test('accepts enhancer for store', () => {
307307
308308describe ( 'event dispatchers' , ( ) => {
309309 test ( 'default' , ( ) => {
310- const game = Game ( { } ) ;
310+ const game = { } ;
311311 const client = Client ( { game } ) ;
312312 expect ( Object . keys ( client . events ) ) . toEqual ( [ 'endTurn' ] ) ;
313313 expect ( client . getState ( ) . ctx . turn ) . toBe ( 0 ) ;
@@ -316,11 +316,11 @@ describe('event dispatchers', () => {
316316 } ) ;
317317
318318 test ( 'all events' , ( ) => {
319- const game = Game ( {
319+ const game = {
320320 endPhase : true ,
321321 endGame : true ,
322322 setActionPlayers : true ,
323- } ) ;
323+ } ;
324324 const client = Client ( { game } ) ;
325325 expect ( Object . keys ( client . events ) ) . toEqual ( [
326326 'endTurn' ,
@@ -334,10 +334,10 @@ describe('event dispatchers', () => {
334334 } ) ;
335335
336336 test ( 'no events' , ( ) => {
337- const game = Game ( {
337+ const game = {
338338 endPhase : false ,
339339 endTurn : false ,
340- } ) ;
340+ } ;
341341 const client = Client ( { game } ) ;
342342 expect ( Object . keys ( client . events ) ) . toEqual ( [ ] ) ;
343343 } ) ;
@@ -418,11 +418,11 @@ describe('log handling', () => {
418418
419419 beforeEach ( ( ) => {
420420 client = Client ( {
421- game : Game ( {
421+ game : {
422422 moves : {
423423 A : ( ) => ( { } ) ,
424424 } ,
425- } ) ,
425+ } ,
426426 } ) ;
427427 } ) ;
428428
0 commit comments