aboutsummaryrefslogtreecommitdiff
path: root/internal/imgw/imgw_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/imgw/imgw_test.go')
-rw-r--r--internal/imgw/imgw_test.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/internal/imgw/imgw_test.go b/internal/imgw/imgw_test.go
index ffc678e..fb1bf21 100644
--- a/internal/imgw/imgw_test.go
+++ b/internal/imgw/imgw_test.go
@@ -53,8 +53,8 @@ func TestPowiatTruncatesTerytToFourDigits(t *testing.T) {
if status != StatusOK {
t.Fatalf("status = %v, want StatusOK", status)
}
- if code != "1815" {
- t.Fatalf("code = %q, want 1815 (first four digits of 126101)", code)
+ if code != "1261" {
+ t.Fatalf("code = %q, want 1261 (first four digits of 126101)", code)
}
}
@@ -108,32 +108,32 @@ func TestPowiatAsksForAWideRadius(t *testing.T) {
func TestWarningsKeepOnlyThisPowiat(t *testing.T) {
pinClock(t, time.Date(2000, 1, 1, 0, 0, 0, 0, time.Local)) // nothing expired
body := `[
- {"nazwa_zdarzenia":"Upal","stopien":"1","obowiazuje_do":"2030-01-01 00:00:00","teryt":["1815","1234"]},
+ {"nazwa_zdarzenia":"Upal","stopien":"1","obowiazuje_do":"2030-01-01 00:00:00","teryt":["1261","1234"]},
{"nazwa_zdarzenia":"Burze","stopien":"2","obowiazuje_do":"2030-01-01 00:00:00","teryt":["2207"]}
]`
srv := serveText(t, body)
warningsURL = srv.URL
- live, err := Warnings("1815")
+ live, err := Warnings("1261")
if err != nil {
t.Fatal(err)
}
if len(live) != 1 || live[0].Event != "Upal" {
- t.Fatalf("got %+v, want only the warning covering 1815", live)
+ t.Fatalf("got %+v, want only the warning covering 1261", live)
}
}
func TestWarningsDropExpiredButKeepUnparseableDates(t *testing.T) {
pinClock(t, time.Date(2026, 8, 10, 12, 0, 0, 0, time.Local))
body := `[
- {"nazwa_zdarzenia":"Wczorajsze","stopien":"1","obowiazuje_do":"2026-08-09 23:00:00","teryt":["1815"]},
- {"nazwa_zdarzenia":"Trwajace","stopien":"1","obowiazuje_do":"2026-08-10 20:00:00","teryt":["1815"]},
- {"nazwa_zdarzenia":"Bezdaty","stopien":"1","obowiazuje_do":"","teryt":["1815"]}
+ {"nazwa_zdarzenia":"Wczorajsze","stopien":"1","obowiazuje_do":"2026-08-09 23:00:00","teryt":["1261"]},
+ {"nazwa_zdarzenia":"Trwajace","stopien":"1","obowiazuje_do":"2026-08-10 20:00:00","teryt":["1261"]},
+ {"nazwa_zdarzenia":"Bezdaty","stopien":"1","obowiazuje_do":"","teryt":["1261"]}
]`
srv := serveText(t, body)
warningsURL = srv.URL
- live, err := Warnings("1815")
+ live, err := Warnings("1261")
if err != nil {
t.Fatal(err)
}
@@ -151,9 +151,9 @@ func TestWarningsDropExpiredButKeepUnparseableDates(t *testing.T) {
// IMGW has been seen to encode TERYT codes as numbers as well as strings.
func TestWarningsMatchNumericTerytCodes(t *testing.T) {
pinClock(t, time.Date(2000, 1, 1, 0, 0, 0, 0, time.Local))
- srv := serveText(t, `[{"nazwa_zdarzenia":"X","obowiazuje_do":"2030-01-01 00:00:00","teryt":[1815]}]`)
+ srv := serveText(t, `[{"nazwa_zdarzenia":"X","obowiazuje_do":"2030-01-01 00:00:00","teryt":[1261]}]`)
warningsURL = srv.URL
- live, err := Warnings("1815")
+ live, err := Warnings("1261")
if err != nil {
t.Fatal(err)
}
@@ -166,7 +166,7 @@ func TestWarningsUnreachableIsAnError(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))
srv.Close()
warningsURL = srv.URL
- if _, err := Warnings("1815"); err == nil {
+ if _, err := Warnings("1261"); err == nil {
t.Fatal("expected an error: the caller must be able to say 'could not check'")
}
}
@@ -177,7 +177,7 @@ func TestWarningsParseTheRecordedFeed(t *testing.T) {
srv := serve(t, "warnings.json", nil)
warningsURL = srv.URL
- if _, err := Warnings("1815"); err != nil {
+ if _, err := Warnings("1261"); err != nil {
t.Fatalf("the recorded feed must parse: %v", err)
}
none, err := Warnings("9999")