Improve error reporting in station_test.go

Modified the error handling sections within the StationSearchByLocation test function to also output the error messages. Changes help in debugging by providing more context whenever the test fails.
This commit is contained in:
Winni Neessen 2023-06-27 18:31:41 +02:00
parent 3eb6a76f5d
commit 65d065dd59
Signed by: wneessen
GPG key ID: 5F3AF39B820C119D

View file

@ -46,7 +46,8 @@ func TestClient_StationSearchByLocation_Fail(t *testing.T) {
t.Errorf("StationSearchByLocation was supposed to fail but didn't")
}
if err != nil && !errors.As(err, &APIError{}) {
t.Errorf("StationSearchByLocation was supposed to throw a APIError but didn't")
t.Errorf("StationSearchByLocation was supposed to throw a APIError but didn't: %s",
err)
}
c = New(WithAPIKey("invalid"))
_, err = c.StationSearchByLocation("Cologne, Germany")
@ -55,7 +56,8 @@ func TestClient_StationSearchByLocation_Fail(t *testing.T) {
return
}
if err != nil && !errors.As(err, &APIError{}) {
t.Errorf("StationSearchByLocation was supposed to throw a APIError but didn't")
t.Errorf("StationSearchByLocation was supposed to throw a APIError but didn't: %s",
err)
}
}