Series drill-down: poster and details of the selected season or episode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019reK4DUGYqDUjniWYJvwUW
This commit is contained in:
2026-10-21 08:28:49 +02:00
co-authored by Claude Opus 5.5
parent 8601a2af6f
commit 60fd71bc92
5 changed files with 114 additions and 13 deletions
+45
View File
@@ -124,3 +124,48 @@ func TestSortEntriesAndDayLabel(t *testing.T) {
}
}
}
func TestSeriesRowDetail(t *testing.T) {
s := sonarr.Series{Title: "Andor", Year: 2022, Network: "Disney+", Status: "ended", Overview: "Series plot"}
// A season: the summary and the series plot.
d := seriesRowDetail(s, nil, 2, seasonSummary{number: 2, total: 12, have: 5}, true, "2026-01-01")
for _, want := range []string{"Andor", "(2022)", "Disney+", "Season 2", "5 of 12 episodes", "Monitored: yes"} {
if !strings.Contains(d.head, want) {
t.Errorf("season head missing %q:\n%s", want, d.head)
}
}
if d.plot != "Series plot" {
t.Errorf("season plot = %q", d.plot)
}
// An episode: its own title, air date, status and plot.
ep := &sonarr.Episode{SeasonNumber: 2, EpisodeNumber: 5, Title: "Welcome [Home]", AirDate: "2025-05-01", HasFile: true, Monitored: true, Overview: "Episode plot"}
d = seriesRowDetail(s, ep, 2, seasonSummary{}, true, "2026-01-01")
for _, want := range []string{"S02E05 Welcome [Home[]", "Aired: 2025-05-01", "downloaded"} {
if !strings.Contains(d.head, want) {
t.Errorf("episode head missing %q:\n%s", want, d.head)
}
}
if d.plot != "Episode plot" {
t.Errorf("episode plot = %q", d.plot)
}
// Without an episode plot the series plot stays.
ep.Overview = ""
if d := seriesRowDetail(s, ep, 2, seasonSummary{}, true, "2026-01-01"); d.plot != "Series plot" {
t.Errorf("fallback plot = %q", d.plot)
}
}
func TestForgetPane(t *testing.T) {
a := newTestApp(t)
n := len(a.panes)
d := newDetailPane(a)
if len(a.panes) != n+1 {
t.Fatal("a new pane must be registered")
}
a.forgetPane(d)
if len(a.panes) != n {
t.Errorf("%d panes after forgetting, want %d", len(a.panes), n)
}
}