harden implementations

This commit is contained in:
seavor 2026-04-12 15:21:29 -05:00
parent c3ae4cffd6
commit 559a3ff1f4
25 changed files with 240 additions and 37 deletions

View file

@ -30,6 +30,8 @@ import { setSideboardLock } from './setSideboardLock';
import { setSideboardPlan } from './setSideboardPlan';
import { shuffle } from './shuffle';
import { undoDraw } from './undoDraw';
import { unconcede } from './unconcede';
import { judge } from './judge';
jest.mock('../../services/BackendService', () => ({
BackendService: { sendGameCommand: jest.fn() },
@ -197,4 +199,19 @@ describe('Game commands — delegate to BackendService.sendGameCommand', () => {
undoDraw(gameId);
expect(BackendService.sendGameCommand).toHaveBeenCalledWith(gameId, 'Command_UndoDraw', {});
});
it('unconcede sends Command_Unconcede with empty object', () => {
unconcede(gameId);
expect(BackendService.sendGameCommand).toHaveBeenCalledWith(gameId, 'Command_Unconcede', {});
});
it('judge sends Command_Judge with targetId and wrapped gameCommand array', () => {
const targetId = 3;
const innerGameCommand = { '.Command_DrawCards.ext': { numberOfCards: 2 } };
judge(gameId, targetId, innerGameCommand);
expect(BackendService.sendGameCommand).toHaveBeenCalledWith(gameId, 'Command_Judge', {
targetId,
gameCommand: [innerGameCommand],
});
});
});