66 * https://opensource.org/licenses/MIT.
77 */
88
9- import Server from './index' ;
9+ import { Server } from './index' ;
1010import Game from '../core/game' ;
1111import * as ActionCreators from '../core/action-creators' ;
1212import * as Redux from 'redux' ;
@@ -61,6 +61,7 @@ const game = Game({ seed: 0 });
6161
6262test ( 'basic' , ( ) => {
6363 const server = Server ( { games : [ game ] } ) ;
64+ server . run ( ) ;
6465 expect ( server ) . not . toBe ( undefined ) ;
6566} ) ;
6667
@@ -77,7 +78,7 @@ test('connect / disconnect', async () => {
7778 const _roomInfo = new Map ( ) ;
7879
7980 const server = Server ( { games : [ game ] , _clientInfo, _roomInfo } ) ;
80- const io = server . context . io ;
81+ const io = server . app . context . io ;
8182
8283 io . socket . id = '0' ;
8384 await io . socket . receive ( 'sync' , 'gameID' , '0' , 2 ) ;
@@ -115,7 +116,7 @@ test('connect / disconnect', async () => {
115116
116117test ( 'sync' , async ( ) => {
117118 const server = Server ( { games : [ game ] } ) ;
118- const io = server . context . io ;
119+ const io = server . app . context . io ;
119120 expect ( server ) . not . toBe ( undefined ) ;
120121
121122 const spy = jest . spyOn ( Redux , 'createStore' ) ;
@@ -139,7 +140,7 @@ test('sync', async () => {
139140
140141test ( 'action' , async ( ) => {
141142 const server = Server ( { games : [ game ] } ) ;
142- const io = server . context . io ;
143+ const io = server . app . context . io ;
143144 const action = ActionCreators . gameEvent ( 'endTurn' ) ;
144145
145146 await io . socket . receive ( 'action' , action ) ;
@@ -218,7 +219,7 @@ test('playerView (sync)', async () => {
218219 } ) ;
219220
220221 const server = Server ( { games : [ game ] } ) ;
221- const io = server . context . io ;
222+ const io = server . app . context . io ;
222223
223224 await io . socket . receive ( 'sync' , 'gameID' , 0 ) ;
224225 expect ( io . socket . emit ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -232,7 +233,7 @@ test('playerView (action)', async () => {
232233 } ,
233234 } ) ;
234235 const server = Server ( { games : [ game ] } ) ;
235- const io = server . context . io ;
236+ const io = server . app . context . io ;
236237 const action = ActionCreators . gameEvent ( 'endTurn' ) ;
237238
238239 io . socket . id = 'first' ;
@@ -272,7 +273,7 @@ test('custom db implementation', async () => {
272273
273274 const game = Game ( { } ) ;
274275 const server = Server ( { games : [ game ] , db : new Custom ( ) } ) ;
275- const io = server . context . io ;
276+ const io = server . app . context . io ;
276277
277278 await io . socket . receive ( 'sync' , 'gameID' ) ;
278279 expect ( getId ) . toBe ( 'gameID' ) ;
0 commit comments