Some checks failed
CI / Unit & Component Tests (push) Failing after 2m33s
CI / OCR Service Tests (push) Successful in 24s
CI / Backend Unit Tests (push) Successful in 3m42s
CI / fail2ban Regex (push) Successful in 43s
CI / Semgrep Security Scan (push) Successful in 22s
CI / Compose Bucket Idempotency (push) Successful in 1m7s
Review follow-up (Sara, fast-follow): the t no-active-region guard and the draw-cue arm/disarm rule lived inline in the page with no direct coverage. Extracted to pure resolveTrainingMark() (no-op when no region; recognition enrolled flip) and canArmDraw()/shouldDisarmDraw(), each with unit tests (10 cases total). The page now arms the draw cue only via canArmDraw and disarms via shouldDisarmDraw, and routes t through resolveTrainingMark. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15 lines
422 B
TypeScript
15 lines
422 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { canArmDraw, shouldDisarmDraw } from './drawCue';
|
|
|
|
describe('draw cue policy', () => {
|
|
it('arms only in edit mode', () => {
|
|
expect(canArmDraw('edit')).toBe(true);
|
|
expect(canArmDraw('read')).toBe(false);
|
|
});
|
|
|
|
it('disarms in every mode except edit', () => {
|
|
expect(shouldDisarmDraw('read')).toBe(true);
|
|
expect(shouldDisarmDraw('edit')).toBe(false);
|
|
});
|
|
});
|