타자 대결 연습: 한 사람이 나가도 남은 사람은 끝까지 침(대결만 한 명 남으면 끝)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,26 @@ function twoPlayers(options: Record<string, unknown>) {
|
||||
}
|
||||
|
||||
describe('타자 대결 room flow', () => {
|
||||
test('연습: 먼저 다 친 사람이 방을 나가도 남은 사람은 끝까지 쳐요', () => {
|
||||
const { h, room, b, s } = twoPlayers({ mode: 'practice', category: 'word' });
|
||||
const typeAll = (who: string) => {
|
||||
const n = s().items.length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
h.clock.advance(3000);
|
||||
room.act(who, 100 + i, { type: 'submit', item: i, text: s().items[i]! });
|
||||
}
|
||||
};
|
||||
typeAll('A');
|
||||
expect(s().rs.A!.finishedAt).not.toBeNull();
|
||||
room.leave('A');
|
||||
expect(s().phase).toBe('playing');
|
||||
expect(lastView(b).upcoming[0]!.idx).toBe(0);
|
||||
typeAll('B');
|
||||
expect(b.msgs.filter((m) => m.t === 'reject')).toEqual([]);
|
||||
expect(s().phase).toBe('ended');
|
||||
expect(s().final!.ranking[0]).toMatchObject({ id: 'B', left: false });
|
||||
});
|
||||
|
||||
test('진행은 stream으로만 가고(보기 다시 계산 없음), 먼저 정확하게 친 사람이 점수를 얻어요', () => {
|
||||
const { h, room, a, b, s } = twoPlayers({ rounds: 1 });
|
||||
const v = lastView(b);
|
||||
|
||||
Reference in New Issue
Block a user