Skip to content

Unit tests for Review stage #232

@SorraTheOrc

Description

@SorraTheOrc

Create comprehensive unit tests for Stage 3 Review in src/tui/tests/review.test.ts:

Test groups:

  1. Pure helper tests:

    • intensityIndex: all 5 values + unknown
    • textureIndex: all 9 values + unknown
    • medianIntensity: odd count, even count, single entry, empty
    • medianTextureIndex: same variations
    • flagCoherenceOutliers: normal flagging, all same (no flags), <3 entries skip, boundary cases (exactly 1 step = no flag, exactly 2 steps = flag)
    • buildSummaryRows: with and without outliers, warning indicator presence
  2. Interactive flow tests:

    • runReviewStage with confirm action returns 'advance'
    • runReviewStage with back action returns 'back'
    • runReviewStage swap flow (select recipe, mock audition, verify updated selection)
    • runReviewStage add flow returns 'back' to re-enter Define
    • runReviewStage remove flow (verify removal from session)
    • <3 entries shows info message, skips coherence
    • Empty palette after removal warns and prevents advance

Follow the mocking pattern from explore.test.ts: mock @inquirer/prompts, ../../output.js, ../../core/renderer.js, ../../audio/player.js.

Acceptance Criteria:

  • All pure helpers have at least 2 test cases each
  • All interactive flows have at least 1 test case each
  • Coherence flagging has boundary tests
  • Tests pass with npm test

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions