diff options
Diffstat (limited to 'internal/api/api_test.go')
| -rw-r--r-- | internal/api/api_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/internal/api/api_test.go b/internal/api/api_test.go new file mode 100644 index 0000000..3940f6e --- /dev/null +++ b/internal/api/api_test.go @@ -0,0 +1,27 @@ +package api + +import ( + "net/http" + "net/http/httptest" + "testing" +) + +func TestHealth(t *testing.T) { + server := New(Config{ + Address: ":0", + }) + + req := httptest.NewRequest( + http.MethodGet, + "/health", + nil, + ) + + rec := httptest.NewRecorder() + + server.mux.ServeHTTP(rec, req) + + if rec.Code != http.StatusOK { + t.Fatalf("expected 200, got %d", rec.Code) + } +} |