Priority: HIGH
Tests Needed
Unit Tests (services/monitor.test.js):
shouldAddToHistory() function with all filter combinations:
- User with history_enabled = 0 → false
- Stream duration < 30s → false
- Progress < 10% on non-audio → false
- Exclusion pattern match → false
- All criteria met → true
- Audiobooks ignore progress filter
- Custom settings override defaults
Integration Tests (session-lifecycle.test.js):
- New session creation
- Session update (same media) - progress only
- Session update (media change) - stops old, creates new
- Session state transitions (playing → paused → stopped)
- Session resume after stop (new session created)
- Stream duration calculation
- History entry creation with all required fields
- Duplicate prevention (one history per session)
- User stats updated (total_plays, total_duration)
Acceptance Criteria
Priority: HIGH
Tests Needed
Unit Tests (
services/monitor.test.js):shouldAddToHistory()function with all filter combinations:Integration Tests (
session-lifecycle.test.js):Acceptance Criteria