M9: 게임 26종 30초 요약 카드·[?] 지금 할 수 있는 것 내용
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
59
apps/web/src/games/catchmind/help.test.ts
Normal file
59
apps/web/src/games/catchmind/help.test.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { expect, test } from 'bun:test';
|
||||
import { applyAction, setupGame, usersOf } from '../help-kit.test-util';
|
||||
import { GAMES } from '@bg/games';
|
||||
import { helpNow } from './help';
|
||||
|
||||
const users = usersOf(['A', 'B', 'C']);
|
||||
const view = (s: unknown, who: string | null) => GAMES.catchmind!.view(s, who) as any;
|
||||
|
||||
test('그림 맞히기: 단어 고르기 — 출제자 / 맞히는 사람 / 관전', () => {
|
||||
const { state } = setupGame('catchmind', 3);
|
||||
const d: string = state.turn.drawer;
|
||||
const g = ['A', 'B', 'C'].find((p) => p !== d)!;
|
||||
const dn = users[d]!.nickname;
|
||||
expect(helpNow(view(state, d), d, users)).toContain('단어 하나를 눌러 골라요');
|
||||
const gt = helpNow(view(state, g), g, users);
|
||||
expect(gt).toContain(`${dn}님이 그릴 단어를 고르고 있어요`);
|
||||
expect(gt).not.toContain(state.turn.choices[0].word);
|
||||
expect(helpNow(view(state, null), null, users)).toContain(`${dn}님이 그릴 단어를 고르고 있어요`);
|
||||
});
|
||||
|
||||
test('그림 맞히기: 그리기 — 출제자는 단어를 보고, 맞히는 사람은 힌트만', () => {
|
||||
const { state } = setupGame('catchmind', 3);
|
||||
const d: string = state.turn.drawer;
|
||||
const [g1, g2] = ['A', 'B', 'C'].filter((p) => p !== d) as [string, string];
|
||||
const s = applyAction('catchmind', state, d, { type: 'chooseWord', index: 0 });
|
||||
const word: string = s.turn.word.word;
|
||||
const dt = helpNow(view(s, d), d, users);
|
||||
expect(dt).toContain(`"${word}"`);
|
||||
expect(dt).toContain('글자나 숫자는 쓰지 말고');
|
||||
expect(dt).toContain('[거의 다 왔어요]');
|
||||
const gt = helpNow(view(s, g1), g1, users);
|
||||
expect(gt).toContain('[맞히기]');
|
||||
expect(gt).toContain('글자예요');
|
||||
expect(gt).not.toContain(word);
|
||||
const spec = helpNow(view(s, null), null, users);
|
||||
expect(spec).toContain('그림을 그리고 있어요');
|
||||
expect(spec).not.toContain(word);
|
||||
|
||||
const s2 = applyAction('catchmind', s, g1, { type: 'guess', text: word });
|
||||
const st = helpNow(view(s2, g1), g1, users);
|
||||
expect(st).toContain('맞혔어요!');
|
||||
expect(st).toContain('이미 맞힌 사람에게만');
|
||||
expect(helpNow(view(s2, g2), g2, users)).not.toContain(word);
|
||||
});
|
||||
|
||||
test('그림 맞히기: 공개 / 끝', () => {
|
||||
const { state } = setupGame('catchmind', 2, { guessMode: 'firstOnly' });
|
||||
const d: string = state.turn.drawer;
|
||||
const g = d === 'A' ? 'B' : 'A';
|
||||
let s = applyAction('catchmind', state, d, { type: 'chooseWord', index: 0 });
|
||||
const word: string = s.turn.word.word;
|
||||
expect(helpNow(view(s, g), g, users)).toContain('가장 먼저 맞힌 사람만');
|
||||
s = applyAction('catchmind', s, g, { type: 'guess', text: word });
|
||||
expect(s.turn.phase).toBe('reveal');
|
||||
expect(helpNow(view(s, g), g, users)).toContain(`정답은 "${word}"였어요`);
|
||||
s.finished = true;
|
||||
s.final = { ranking: [], turns: [], summary: '호랑이님 우승!' };
|
||||
expect(helpNow(view(s, null), null, users)).toContain('호랑이님 우승!');
|
||||
});
|
||||
Reference in New Issue
Block a user