0.2.52
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ponzischeme89/memby/server/internal/sonarr"
|
||||
)
|
||||
|
||||
func TestSonarrSeriesStatusKeyPrefersTVDBIdentity(t *testing.T) {
|
||||
series := sonarr.Series{ID: 42, TVDBID: 1234}
|
||||
if got := sonarrSeriesStatusKey(series); got != "tvdb:1234" {
|
||||
t.Fatalf("status key = %q, want tvdb:1234", got)
|
||||
}
|
||||
series.TVDBID = 0
|
||||
if got := sonarrSeriesStatusKey(series); got != "sonarr:42" {
|
||||
t.Fatalf("fallback status key = %q, want sonarr:42", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSonarrCancellationRequiresAnActiveHistory(t *testing.T) {
|
||||
for _, transition := range [][2]string{
|
||||
{"continuing", "ended"},
|
||||
{"upcoming", "deleted"},
|
||||
{"Continuing", "cancelled"},
|
||||
} {
|
||||
if !sonarrBecameCancelled(transition[0], transition[1]) {
|
||||
t.Errorf("%q -> %q should be a cancellation", transition[0], transition[1])
|
||||
}
|
||||
}
|
||||
for _, transition := range [][2]string{
|
||||
{"", "ended"}, // first scan is a baseline, not news
|
||||
{"ended", "ended"}, // an unchanged cancelled show is not announced daily
|
||||
{"ended", "continuing"},
|
||||
{"continuing", "continuing"},
|
||||
} {
|
||||
if sonarrBecameCancelled(transition[0], transition[1]) {
|
||||
t.Errorf("%q -> %q should not be a cancellation", transition[0], transition[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user