그림 맞히기·클루: 그리기·차례 시간 무제한(출제자 정답 공개로 넘기기), 소리·움직임, 할리갈리·사과 게임 문서에 무제한

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-13 13:01:42 +09:00
parent bafbf95d98
commit b8966db2a6
15 changed files with 413 additions and 84 deletions

View File

@@ -10,7 +10,7 @@ import { RoomStore } from './store';
type Msgs = ServerMessage[];
type StateMsg = Extract<ServerMessage, { t: 'state' }>;
function harness(players: string[]) {
function harness(players: string[], options: Record<string, unknown> = {}) {
const db = openDb(':memory:');
const store = new RoomStore(db);
let now = 1_000_000;
@@ -19,7 +19,7 @@ function harness(players: string[]) {
const deps = { store, games, users: { publicUser: (id: string) => ({ id, nickname: id, avatar: null, kind: 'guest' as const }) }, now: clock.now };
const config: RoomConfig = {
gameId: 'catchmind',
options: games.catchmind.defaultOptions,
options: { ...games.catchmind.defaultOptions, ...options },
maxPlayers: players.length,
visibility: 'private',
allowSpectators: true,
@@ -170,12 +170,29 @@ describe('그림 맞히기 room flow', () => {
expect(state().away).toEqual([d]);
});
test('그리기 무제한: 연결된 출제자는 타이머 없음, 연결이 끊기면 10초 뒤 턴 종료', () => {
const { room, clock, conns, state, act } = harness(['A', 'B'], { drawSeconds: null, hints: 'basic' });
const d = state().turn.drawer;
act(d, { type: 'chooseWord', index: 0 });
expect(state().turn.endsAt).toBeNull();
expect(room.effectiveDeadline()).toBeNull();
clock.advance(600_000);
expect(state().turn.phase).toBe('drawing');
room.disconnect(conns[d]!);
room.clearTimer();
expect(room.effectiveDeadline()).toBe(clock.now() + 10_000);
clock.advance(10_000);
room.onTimer();
room.clearTimer();
expect(state().turn.endReason).toBe('drawerAway');
});
test('연결된 출제자는 힌트·시간 만료 때만 tick(10초 지나도 끝나지 않음)', () => {
const { room, clock, state, act } = harness(['A', 'B']);
const d = state().turn.drawer;
act(d, { type: 'chooseWord', index: 0 });
const t0 = state().turn.startedAt;
const ends = state().turn.endsAt;
const ends = state().turn.endsAt!;
expect(room.effectiveDeadline()).toBe(t0 + (ends - t0) / 2);
clock.advance(20_000);
room.onTimer();