fixup! test(api): add basic tests for generateJSON()

This commit is contained in:
Guanran Wang 2024-10-26 19:01:37 +08:00
parent 7500d04c65
commit 659ce3064b
Signed by: nyancat
GPG key ID: 91F97D9ED12639CF

View file

@ -7,7 +7,7 @@ import (
func TestInvalidIP(t *testing.T) {
_, err := generateJSON("foo")
errwant := "invalid IP"
if err.Error() != errwant {
if err == nil || err.Error() != errwant {
t.Fatalf(`generateJSON("foo") == "%v", wants "%s"`, err, errwant)
}
}
@ -15,7 +15,7 @@ func TestInvalidIP(t *testing.T) {
func TestInaccessibleIP(t *testing.T) {
_, err := generateJSON("0.0.0.0")
errwant := "unspecified IP"
if err.Error() != errwant {
if err == nil || err.Error() != errwant {
t.Fatalf(`generateJSON("0.0.0.0") == "%v", wants "%s"`, err, errwant)
}
}