Skip to content

Phase 2: Extended fake-claude.mjs scenarios and unit tests #5

Description

@tinkermonkey

Add four new scenario branches to the existing fake-claude.mjs fixture and write corresponding unit tests in the fast (offline) test suite. This strengthens coverage of EventParser and CliProcess edge cases without requiring credentials or a live binary.

Requirements

  • Add session-resume scenario to fake-claude.mjs: accepts --resume <id> CLI flag, emits system/init event with that same session ID, exits cleanly with code 0
  • Add rate-limit scenario: emits a rate_limit_event line on stdout (not stderr only), then exits with a non-zero code
  • Add permission-request scenario: emits a server_tool_use block inside an assistant event after system/init, before the result event
  • Add multi-block scenario: emits a single assistant event whose message.content array contains both a text block and a tool_use block in one emission
  • Any unknown FAKE_SCENARIO value must write to stderr and exit with code 1
  • Add one test per new scenario in CliProcess.test.ts and/or EventParser.test.ts, following the existing FAKE_SCENARIO injection pattern (set env var, inject fixture into PATH, collect events, assert structure)
  • All new tests must pass with npm test (no credentials required)

Design Guidance

Implements the 'Extended Fake Fixture Scenarios' section of the architecture design. The four scenario names, their trigger conditions, and their expected output structure are specified in the architecture's component design table for fake-claude.mjs scenarios.

Acceptance Criteria

  • FAKE_SCENARIO=session-resume with --resume <id> arg emits system/init with matching session ID
  • FAKE_SCENARIO=rate-limit emits rate_limit_event on stdout and exits non-zero
  • FAKE_SCENARIO=permission-request emits server_tool_use inside an assistant event
  • FAKE_SCENARIO=multi-block emits a single assistant event with both text and tool_use content blocks
  • Unknown FAKE_SCENARIO value causes exit code 1 with stderr message
  • One new vitest test exists per scenario and passes under npm test
  • npm test total test count increases by at least 4
  • Code is reviewed and approved

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions