test: fix port default test to match behavior

This commit is contained in:
2026-07-04 05:20:36 +02:00
parent 9c19f0da1e
commit 57a6aa8f7a

View File

@@ -95,13 +95,16 @@ func TestLoadInvalidEpisodeAvailabilityMode(t *testing.T) {
} }
} }
func TestLoadEmptyPortIsError(t *testing.T) { func TestLoadEmptyPortDefaultsTo3000(t *testing.T) {
os.Setenv("PORT", "") os.Setenv("PORT", "")
os.Setenv("DATABASE_FILE", "mal.db") os.Setenv("DATABASE_FILE", "mal.db")
defer os.Unsetenv("PORT") defer os.Unsetenv("PORT")
_, err := Load() cfg, err := Load()
if err == nil { if err != nil {
t.Fatal("expected error for empty PORT") t.Fatalf("Load(): %v", err)
}
if cfg.Port != "3000" {
t.Fatalf("Port = %q, want %q", cfg.Port, "3000")
} }
} }