Closed nicolodavis closed 5 years ago
A unit test (after fixing the above) currently looks like this:
const client = Client({
game: Game({
moves: {
A: (G, ctx, arg) => ({ arg }),
},
}),
multiplayer: { local: true },
});
await client.updatePlayerID('0');
await client.connect();
expect(client.getState().G).toEqual({});
client.moves.A(42);
expect(client.getState().G).toEqual({ arg: 42 });
Perhaps we should bundle in a test-friendly client that is able to switch players more seamlessly without needing to call connect
each time.
https://github.com/nicolodavis/boardgame.io/blob/master/src/client/client.js#L219
This prevents it from being used directly with local multiplayer (useful in unit tests).