M9: 초보자 도움 틀 — 30초 규칙 요약 카드, 게임 중 [?] 지금 할 수 있는 것, 오목 내용
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
26
apps/web/src/games/omok/help.test.ts
Normal file
26
apps/web/src/games/omok/help.test.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
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']);
|
||||
const view = (s: unknown, who: string | null) => GAMES.omok!.view(s, who) as any;
|
||||
|
||||
test('오목: 내 차례 / 상대 차례 / 관전 / 첫 수 가운데', () => {
|
||||
const { state } = setupGame('omok', 2, { colorAssignment: 'hostBlack', ruleSet: 'renju' });
|
||||
expect(helpNow(view(state, 'A'), 'A', users)).toContain('첫 수는 판 한가운데');
|
||||
expect(helpNow(view(state, 'B'), 'B', users)).toContain('상대(호랑이님) 차례예요');
|
||||
expect(helpNow(view(state, null), null, users)).toContain('호랑이님(흑) 차례예요');
|
||||
const s2 = applyAction('omok', state, 'A', { type: 'place', x: 7, y: 7 });
|
||||
const t = helpNow(view(s2, 'B'), 'B', users);
|
||||
expect(t).toContain('내 차례예요(백)');
|
||||
expect(t).toContain('5개');
|
||||
});
|
||||
|
||||
test('오목: 무르기 요청을 받으면 수락/거절 안내', () => {
|
||||
const { state } = setupGame('omok', 2, { colorAssignment: 'hostBlack', ruleSet: 'free' });
|
||||
let s = applyAction('omok', state, 'A', { type: 'place', x: 7, y: 7 });
|
||||
s = applyAction('omok', s, 'A', { type: 'requestUndo' });
|
||||
expect(helpNow(view(s, 'B'), 'B', users)).toContain('[수락]');
|
||||
expect(helpNow(view(s, 'A'), 'A', users)).toContain('무르기 요청');
|
||||
});
|
||||
Reference in New Issue
Block a user