Skip to content

Commit

Permalink
log a message when INVALID_MOVE is returned
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolodavis committed Oct 25, 2019
1 parent 3d02adf commit e9351dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ export function CreateGameReducer({ game, multiplayer }) {

// The game declared the move as invalid.
if (G === INVALID_MOVE) {
error(
`invalid move: ${action.payload.type} args: ${action.payload.args}`
);
return state;
}

Expand Down
1 change: 1 addition & 0 deletions src/core/reducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ test('move returns INVALID_MOVE', () => {
};
const reducer = CreateGameReducer({ game });
let state = reducer(initialState, makeMove('A'));
expect(error).toBeCalledWith('invalid move: A args: undefined');
expect(state._stateID).toBe(0);
});

Expand Down

0 comments on commit e9351dc

Please sign in to comment.