Skip to content

TEST: Session management and history recording tests #10

@mondominator

Description

@mondominator

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

  • Session lifecycle fully tested
  • History filtering logic verified
  • Edge cases (paused timeout, stale cleanup) covered

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