refactor(transcribe): extract t-mark + draw-cue policy into tested helpers (#327)
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
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>
This commit was merged in pull request #728.
This commit is contained in:
14
frontend/src/lib/document/transcription/drawCue.spec.ts
Normal file
14
frontend/src/lib/document/transcription/drawCue.spec.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user