From 659ce3064b517a9698c7b1a80c40701a93633997 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sat, 26 Oct 2024 19:01:37 +0800 Subject: [PATCH] fixup! test(api): add basic tests for generateJSON() --- api/main_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/main_test.go b/api/main_test.go index b395be0..9e08553 100644 --- a/api/main_test.go +++ b/api/main_test.go @@ -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) } }