Priority: MEDIUM
Problem
The project has zero tests. This creates high regression risk when refactoring core pipeline logic like thinking tag detection, sentence splitting, and TTS queue ordering.
Suggested Approach
Add a Jest test suite with focus on the most critical paths:
Test Structure
frontend/
├── src/
└── tests/
├── unit/
│ ├── Orchestrator.test.js # Thinking detection, sentence splitting, state transitions
│ ├── LLMClient.test.js # SSE parsing, abort handling, error types
│ ├── TTSManager.test.js # Queue ordering, failure handling, PCM decoding
│ ├── ConversationManager.test.js # History trimming, emotion tag parsing
│ ├── EmotionController.test.js # Emotion mapping, decay timing
│ └── STTManager.test.js # VAD integration, transcription handling
├── integration/
│ └── pipeline.test.js # End-to-end pipeline with mocked services
└── fixtures/
└── mock-responses.js # Mock SSE streams, TTS responses
Critical Test Cases
- Thinking tag detection —
<think> present, absent, malformed (<think without close)
- Sentence splitting — Standard punctuation, ellipsis, abbreviations, quotes, Unicode
- Emotion tag parsing — Known emotions, unknown emotions (should default to neutral), no tag
- TTS queue ordering — Sentences must play in order, queue clear during processing
- Retry logic — Verify exponential backoff timing, max retries respected
- State machine — No invalid transitions, barge-in interrupts correctly
Files Affected
frontend/package.json (add jest dependency + test script)
- New test files as described above
Priority: MEDIUM
Problem
The project has zero tests. This creates high regression risk when refactoring core pipeline logic like thinking tag detection, sentence splitting, and TTS queue ordering.
Suggested Approach
Add a Jest test suite with focus on the most critical paths:
Test Structure
Critical Test Cases
<think>present, absent, malformed (<thinkwithout close)Files Affected
frontend/package.json(add jest dependency + test script)