Files
silo-server/internal/audiobooks/abs/progress_internal_test.go
T
RXWatcherandClaude Opus 4.7 8c60e48817 feat(audiobooks): port ABS progress + continue listening
Stage 4 of the ABS-compat port. Five handlers:
  - GET  /abs/api/me/progress
  - GET  /abs/api/me/progress/{libraryItemId}
  - POST /abs/api/me/progress/{libraryItemId}
  - PATCH /abs/api/session/{sid}
  - POST /abs/api/session/{sid}/close

Reads/writes hit silo's user_watch_progress (keyed by user_id,
profile_id, content_id) for resume positions and the new
abs_playback_sessions table (migration 143) for per-session
listening-time tracking.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 15:35:34 +02:00

21 lines
397 B
Go

package abs
import (
"testing"
"time"
)
func TestProgressRowToABSEmitsDuration(t *testing.T) {
out := progressRowToABS(ProgressRow{
UserID: "u1",
ContentID: "b1",
CurrentSeconds: 30,
DurationSeconds: 3600,
ProgressPct: 0.0083,
UpdatedAt: time.Now(),
})
if out["duration"] != float64(3600) {
t.Errorf("duration = %v, want 3600", out["duration"])
}
}