46 lines
2.2 KiB
TypeScript
46 lines
2.2 KiB
TypeScript
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['las-vegas']!.view(s, who) as any;
|
|
|
|
test('라스베가스: 굴리기 차례 / 기다리기 / 관전', () => {
|
|
const { state } = setupGame('las-vegas', 3);
|
|
const cur: string = state.seats[state.current];
|
|
const other = state.seats.find((p: string) => p !== cur)!;
|
|
const nick = users[cur]!.nickname;
|
|
const mine = helpNow(view(state, cur), cur, users);
|
|
expect(mine).toContain('[🎲 주사위 굴리기]');
|
|
expect(mine).toContain('남은 주사위 8개');
|
|
const wait = helpNow(view(state, other), other, users);
|
|
expect(wait).toContain(`${nick}님이 주사위를 굴릴 차례예요`);
|
|
expect(wait).toContain('내 주사위는 8개 남았어요');
|
|
const spec = helpNow(view(state, null), null, users);
|
|
expect(spec).toContain(`${nick}님이 주사위를 굴릴 차례예요`);
|
|
expect(spec).toContain('1/4라운드');
|
|
});
|
|
|
|
test('라스베가스: 굴린 뒤 숫자 고르기와 미리 보기', () => {
|
|
const { state } = setupGame('las-vegas', 2);
|
|
const cur: string = state.seats[state.current];
|
|
const other = state.seats.find((p: string) => p !== cur)!;
|
|
const s = applyAction('las-vegas', state, cur, { type: 'ROLL' });
|
|
const t = helpNow(view(s, cur), cur, users);
|
|
expect(t).toContain('개 놓기] 버튼');
|
|
expect(t).toContain('지금 상황에서 놓으면');
|
|
expect(t).toContain('일부만 놓을 수는 없어요');
|
|
expect(helpNow(view(s, other), other, users)).toContain('놓을 숫자를 고르는 중이에요');
|
|
// 2명: 흰 주사위 4개를 함께 가져요.
|
|
expect(helpNow(view(state, other), other, users)).toContain('흰 주사위 4개 포함');
|
|
});
|
|
|
|
test('라스베가스: 기권하면 구경', () => {
|
|
const { state } = setupGame('las-vegas', 3);
|
|
const cur: string = state.seats[state.current];
|
|
const other = state.seats.find((p: string) => p !== cur)!;
|
|
const s = applyAction('las-vegas', state, other, { type: 'CONCEDE' });
|
|
expect(helpNow(view(s, other), other, users)).toContain('기권해서');
|
|
});
|