Files
scrabble-game/ui/src/lib/premiums.test.ts
T
Ilia Denisov 8881214213 R6(a): de-stage code, docs, READMEs; split stage6_test
Mechanical, behaviour-preserving removal of Stage N / TODO-N / phase (RN)
references from comments, doc-comments, service READMEs, the current-state docs
(ARCHITECTURE, FUNCTIONAL+_ru, TESTING, UI_DESIGN), config-file comments, and the
.fbs/.proto schema comments. PLAN.md / PRERELEASE.md / CLAUDE.md keep the stage
history.

- Rename the only stage-named identifiers: registerStage8 -> registerSocialOps,
  registerStage11 -> registerLinkOps (gateway transcode).
- Split stage6_test.go: TestEmailLoginFlow -> email_test.go,
  TestGuestAutoMatchLeavesNoStats (+ provisionGuest) -> account_test.go.
- Regenerated proto bindings (push.pb.go, telegram_grpc.pb.go) from the de-staged
  .proto comments; FB Go/TS bindings unchanged (flatc strips schema comments).

go build/vet/gofmt clean across modules; integration typecheck and pnpm check green.
2026-06-10 16:56:03 +02:00

40 lines
1.5 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { BOARD_SIZE, centre, premiumGrid } from './premiums';
// Premium-square geometry parity with scrabble-solver/rules/rules.go: scrabble_en/scrabble_ru
// share standardBoard (centre is a double word); erudit_ru shares the geometry but a
// non-doubling centre. Tile-value and alphabet parity moved to the Go engine test
// (backend/internal/engine AlphabetTable) — the server now owns that table.
describe('premium layout', () => {
it('is a 15x15 grid with TW corners', () => {
const g = premiumGrid('scrabble_en');
expect(g.length).toBe(BOARD_SIZE);
expect(g[0].length).toBe(BOARD_SIZE);
for (const [r, c] of [
[0, 0],
[0, 14],
[14, 0],
[14, 14],
]) {
expect(g[r][c]).toBe('TW');
}
});
it('doubles the centre for standard variants but not for erudit_ru', () => {
expect(centre('scrabble_en')).toEqual({ row: 7, col: 7 });
expect(premiumGrid('scrabble_en')[7][7]).toBe('DW');
expect(premiumGrid('scrabble_ru')[7][7]).toBe('DW');
expect(centre('erudit_ru')).toEqual({ row: 7, col: 7 });
expect(premiumGrid('erudit_ru')[7][7]).toBe('');
});
it('keeps the standard premium counts', () => {
const flat = premiumGrid('scrabble_en').flat();
const count = (p: string) => flat.filter((x) => x === p).length;
expect(count('TW')).toBe(8);
expect(count('TL')).toBe(12);
expect(count('DL')).toBe(24);
expect(count('DW')).toBe(17); // 16 double-word squares + the centre
});
});