Description
Bring the Dialogue feature to adequate test coverage — parser fixtures, reducer TestStore cases, view snapshots across appearances.
Spec: Epic #250 §9 acceptance criteria.
Scope
Parser tests (AgentChatTests/Parser/)
Extend fixtures from D-8:
- 20+ real JSONL snippets covering every event type from spec §2.
- Dedup test with reconnect-like duplicate streams.
- Overflow (10+ MiB single line) drop + continue test.
- Tolerant decode (unknown fields in known type).
- Partial-line (byte-by-byte feeding).
- Unknown event type →
.unknownEvent(raw:).
Reducer tests (AgentChatTests/Reducer/)
TestStore flows:
- Happy path: init → text response → tool_use → tool_result → completed → result.
- Tool failure path.
- API retry → recovered.
- Rate limit rejected → status .error.
- Compact boundary divider.
- Interrupt mid-stream.
- Unknown event logging.
- Cost threshold crossed → costAlertShown = true.
View snapshot tests (AgentChatUISnapshotTests/)
Using pointfreeco/swift-snapshot-testing:
- All 12 tool widgets × 4 appearances (light/dark/HCR/reduceTransparency) — populated / collapsed / expanded states.
- Message views — short / long / multi-segment × 4 appearances.
- ThinkingIndicator — collapsed / expanded / streaming / completed.
- DialogueView composite — empty / streaming / tool running / error / rate-limited.
- PreflightErrorView — each reason variant.
- StreamInspectorView — filtered / unfiltered.
Coverage target
Not aiming for % metric — aim for flow coverage. Every user-visible state of every view should have at least one snapshot; every reducer transition should have at least one TestStore case.
Acceptance Criteria
Relationships
Description
Bring the Dialogue feature to adequate test coverage — parser fixtures, reducer TestStore cases, view snapshots across appearances.
Spec: Epic #250 §9 acceptance criteria.
Scope
Parser tests (
AgentChatTests/Parser/)Extend fixtures from D-8:
.unknownEvent(raw:).Reducer tests (
AgentChatTests/Reducer/)TestStore flows:
View snapshot tests (
AgentChatUISnapshotTests/)Using
pointfreeco/swift-snapshot-testing:Coverage target
Not aiming for % metric — aim for flow coverage. Every user-visible state of every view should have at least one snapshot; every reducer transition should have at least one TestStore case.
Acceptance Criteria
swift testin each new package passes.Relationships