Stage 7: regression tests for the polished UI (logic + behaviour)
Lock the polish branch's behaviour so a future UI edit surfaces as a failing
assertion to re-agree or fix.
Unit (vitest, node env):
- placement: recallIndex, cellOccupied/isBlankSlot, non-linear direction, the
single-tile submit default, and placementFromHint blank-fallback / rack-exhausted.
- banner: the marquee scroll-cycle repeat-then-advance, stop(), root-relative and
multiple links.
- client.GatewayError. Extract the check-word constraints out of Game.svelte into a
pure lib/checkword.ts (sanitize + canCheck) and cover them.
E2E (playwright mock, Chromium + WebKit):
- commit via the 🏁 control, history slide-down + close, the exchange dialog,
check-word input sanitising + verdict, resign-to-finished, and the Settings
board-label mode changing the on-board labels.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { GatewayError } from './client';
|
||||
|
||||
describe('GatewayError', () => {
|
||||
it('carries a stable code and is a real Error', () => {
|
||||
const e = new GatewayError('no_hint_available');
|
||||
expect(e).toBeInstanceOf(Error);
|
||||
expect(e.name).toBe('GatewayError');
|
||||
expect(e.code).toBe('no_hint_available');
|
||||
expect(e.message).toBe('no_hint_available'); // message defaults to the code
|
||||
});
|
||||
|
||||
it('keeps a custom message while the code stays the i18n lookup key', () => {
|
||||
const e = new GatewayError('not_your_turn', 'It is not your turn');
|
||||
expect(e.code).toBe('not_your_turn');
|
||||
expect(e.message).toBe('It is not your turn');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user