0.2.67 - Detail pages improvements
This commit is contained in:
@@ -23,8 +23,9 @@ func TestBuildSonarrRowIncludesScheduleAndAddedState(t *testing.T) {
|
||||
Monitored: true,
|
||||
EpisodeFile: &sonarr.EpisodeFile{DateAdded: &added},
|
||||
Series: sonarr.Series{
|
||||
ID: 7,
|
||||
Title: "Northbound",
|
||||
ID: 7,
|
||||
Title: "Northbound",
|
||||
Monitored: true,
|
||||
Images: []sonarr.Image{
|
||||
{CoverType: "poster"},
|
||||
{CoverType: "fanart"},
|
||||
@@ -52,6 +53,42 @@ func TestBuildSonarrRowIncludesScheduleAndAddedState(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Sonarr's calendar is asked with unmonitored=true, because the calendar page and the
|
||||
// aired banners want the whole picture. The launcher row does not: a show nobody follows
|
||||
// is never coming, so it has no business being announced as airing.
|
||||
func TestBuildSonarrRowDropsUnmonitoredShows(t *testing.T) {
|
||||
location := time.UTC
|
||||
now := time.Date(2026, 7, 27, 8, 0, 0, 0, location)
|
||||
air := time.Date(2026, 7, 27, 20, 0, 0, 0, location)
|
||||
episode := func(id int, series sonarr.Series) sonarr.Episode {
|
||||
utc := air
|
||||
return sonarr.Episode{
|
||||
ID: id, SeriesID: series.ID, SeasonNumber: 1, EpisodeNumber: id,
|
||||
Title: "Episode", AirDateUTC: &utc, Monitored: true, Series: series,
|
||||
}
|
||||
}
|
||||
row, err := buildSonarrRow([]sonarr.Episode{
|
||||
episode(1, sonarr.Series{ID: 1, Title: "Followed", Monitored: true}),
|
||||
episode(2, sonarr.Series{ID: 2, Title: "Dropped"}),
|
||||
// No expanded series record is no evidence either way, so the card stays.
|
||||
episode(3, sonarr.Series{}),
|
||||
}, now, location, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ids := make([]string, 0, len(row.Items))
|
||||
for _, raw := range row.Items {
|
||||
var item sonarrScheduleItem
|
||||
if err := json.Unmarshal(raw, &item); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ids = append(ids, item.ID)
|
||||
}
|
||||
if len(ids) != 2 || ids[0] != "sonarr:1:1" || ids[1] != "sonarr:0:3" {
|
||||
t.Fatalf("unmonitored shows were not dropped: %v", ids)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildSonarrRowLinksTheEmbySeries(t *testing.T) {
|
||||
location := time.UTC
|
||||
now := time.Date(2026, 7, 27, 8, 0, 0, 0, location)
|
||||
@@ -65,7 +102,7 @@ func TestBuildSonarrRowLinksTheEmbySeries(t *testing.T) {
|
||||
utc := air
|
||||
return sonarr.Episode{
|
||||
ID: 1, SeriesID: 1, SeasonNumber: 1, EpisodeNumber: 1, AirDateUTC: &utc,
|
||||
Series: sonarr.Series{ID: 1, Title: title, Year: year},
|
||||
Series: sonarr.Series{ID: 1, Title: title, Year: year, Monitored: true},
|
||||
}
|
||||
}
|
||||
cases := map[string]struct {
|
||||
@@ -169,7 +206,7 @@ func TestBuildSonarrRowCoversFiveDaysAndUsesRelativeAirLabels(t *testing.T) {
|
||||
return sonarr.Episode{
|
||||
ID: id, SeriesID: id, SeasonNumber: 1, EpisodeNumber: id,
|
||||
Title: "Episode", AirDateUTC: &utc,
|
||||
Series: sonarr.Series{ID: id, Title: "Show"},
|
||||
Series: sonarr.Series{ID: id, Title: "Show", Monitored: true},
|
||||
}
|
||||
}
|
||||
row, err := buildSonarrRow([]sonarr.Episode{
|
||||
|
||||
Reference in New Issue
Block a user