Series drill-down: mark downloading episodes and seasons
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -381,3 +381,31 @@ func TestDownloadingTitlesAreMarked(t *testing.T) {
|
||||
t.Error("an unmonitored title in the queue keeps the hollow mark")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEpisodesInTheQueue(t *testing.T) {
|
||||
got := queueByEpisode([]arr.QueueItem{
|
||||
{SeriesID: 7, EpisodeID: 70, Size: 10, SizeLeft: 5, TimeLeft: "00:01:00"},
|
||||
{SeriesID: 7, EpisodeID: 71},
|
||||
{SeriesID: 8, EpisodeID: 80}, // another series
|
||||
{SeriesID: 7}, // no episode
|
||||
}, 7)
|
||||
if len(got) != 2 || got[70].progress != 50 || got[70].timeLeft != "00:01:00" {
|
||||
t.Fatalf("queueByEpisode: %+v", got)
|
||||
}
|
||||
|
||||
s := sonarr.Series{Title: "Signal Fire"}
|
||||
ep := &sonarr.Episode{SeasonNumber: 3, EpisodeNumber: 5, Title: "Ember", Monitored: true}
|
||||
if d := seriesRowDetail(s, ep, 3, seasonSummary{}, true, "2026-01-01", got[70]); !strings.Contains(d.head, "Downloading[-] 50% · 00:01:00 left") {
|
||||
t.Errorf("episode: %q", d.head)
|
||||
}
|
||||
sum := seasonSummary{number: 3, total: 10, have: 4}
|
||||
if d := seriesRowDetail(s, nil, 3, sum, true, "2026-01-01", dlInfo{count: 1}); !strings.Contains(d.head, "Downloading[-] 1 episode\n") {
|
||||
t.Errorf("season with one: %q", d.head)
|
||||
}
|
||||
if d := seriesRowDetail(s, nil, 3, sum, true, "2026-01-01", dlInfo{count: 2}); !strings.Contains(d.head, "Downloading[-] 2 episodes") {
|
||||
t.Errorf("season with two: %q", d.head)
|
||||
}
|
||||
if d := seriesRowDetail(s, ep, 3, seasonSummary{}, true, "2026-01-01", dlInfo{}); strings.Contains(d.head, "Downloading") {
|
||||
t.Errorf("not downloading: %q", d.head)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user