- lib/seat-rows.ts: 게임 칸 실제 폭으로 한 줄 칸 수를 정하고 줄마다 고르게 나눔(9 → 5 + 4) - 720px 이상에서만 적용, 휴대폰은 한 줄 옆 밀기 그대로 - docs/07 3.5에 규칙 추가 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
664 B
TypeScript
20 lines
664 B
TypeScript
import { expect, test } from 'bun:test';
|
|
import { seatCols, seatsPerRow } from './seat-rows';
|
|
|
|
test('seatCols keeps one row when it fits and balances rows when it wraps', () => {
|
|
expect(seatCols(0, 8)).toBe(1);
|
|
expect(seatCols(3, 8)).toBe(3);
|
|
expect(seatCols(8, 8)).toBe(8);
|
|
expect(seatCols(9, 8)).toBe(5);
|
|
expect(seatCols(9, 5)).toBe(5);
|
|
expect(seatCols(6, 5)).toBe(3);
|
|
expect(seatCols(7, 5)).toBe(4);
|
|
});
|
|
|
|
test('seatsPerRow counts whole seats including gaps', () => {
|
|
expect(seatsPerRow(1000, 118, 8)).toBe(8);
|
|
expect(seatsPerRow(999, 118, 8)).toBe(7);
|
|
expect(seatsPerRow(652, 118, 8)).toBe(5);
|
|
expect(seatsPerRow(50, 118, 8)).toBe(1);
|
|
});
|