M9: 게임 26종 30초 요약 카드·[?] 지금 할 수 있는 것 내용
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
49
apps/web/src/games/ninety-nine/help.test.ts
Normal file
49
apps/web/src/games/ninety-nine/help.test.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
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['ninety-nine']!.view(s, who) as any;
|
||||
const nickOf = (id: string) => users[id]!.nickname;
|
||||
|
||||
test('구십구: 내 차례 / 상대 차례 / 관전', () => {
|
||||
const { state } = setupGame('ninety-nine', 3);
|
||||
const cur = state.current as string;
|
||||
const other = ['A', 'B', 'C'].find((p) => p !== cur)!;
|
||||
expect(helpNow(view(state, cur), cur, users)).toContain('내 차례예요(지금 합계 0)');
|
||||
const t = helpNow(view(state, other), other, users);
|
||||
expect(t).toContain(`${nickOf(cur)}님 차례예요(지금 합계 0)`);
|
||||
expect(t).toContain('바로 탈락해요');
|
||||
const spec = helpNow(view(state, null), null, users);
|
||||
expect(spec).toContain(`${nickOf(cur)}님 차례예요`);
|
||||
expect(spec).toContain('99를 넘게');
|
||||
const card = view(state, cur).my.hand.find((c: any) => c.kind !== 'joker');
|
||||
const s2 = applyAction('ninety-nine', state, cur, { type: 'play', cardId: card.id, ...(card.choices.length > 1 ? (card.choices[0].sign ? { sign: '+' } : { aceValue: 1 }) : {}) });
|
||||
expect(helpNow(view(s2, s2.current), s2.current, users)).toContain(`지금 합계 ${s2.total}`);
|
||||
});
|
||||
|
||||
test('구십구: 합계 95에서 낼 수 있는 카드만 밝게, ±카드 안내', () => {
|
||||
const { state } = setupGame('ninety-nine', 3);
|
||||
const cur = state.current as string;
|
||||
state.total = 95;
|
||||
state.hands[cur] = [
|
||||
{ id: 'q1', kind: 'add', v: 8, face: { label: '8' } },
|
||||
{ id: 'q2', kind: 'add', v: 7, face: { label: '7' } },
|
||||
{ id: 'q3', kind: 'plusMinus', v: 9, face: { label: '±9' } },
|
||||
];
|
||||
const t = helpNow(view(state, cur), cur, users);
|
||||
expect(t).toContain('밝게 보이는 카드만 낼 수 있어요(1장)');
|
||||
expect(t).toContain('±카드는');
|
||||
});
|
||||
|
||||
test('구십구: 목숨 규칙과 탈락', () => {
|
||||
const { state } = setupGame('ninety-nine', 3, { lives: 3 });
|
||||
const cur = state.current as string;
|
||||
const other = ['A', 'B', 'C'].find((p) => p !== cur)!;
|
||||
const t = helpNow(view(state, other), other, users);
|
||||
expect(t).toContain('목숨 1개를 잃고');
|
||||
expect(t).toContain('내 목숨은 3개예요');
|
||||
state.alive[other] = false;
|
||||
expect(helpNow(view(state, other), other, users)).toContain('탈락했어요');
|
||||
});
|
||||
Reference in New Issue
Block a user