From f7594a128e700a5a6171d218073292209acb35d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miros=C5=82aw=20Sarna?= Date: Fri, 20 Dec 2024 15:43:12 +0100 Subject: [PATCH] test (api) adding test for health --- cmd/mcvs-stub-server/main_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/mcvs-stub-server/main_test.go b/cmd/mcvs-stub-server/main_test.go index e1764b9..ef3d21f 100644 --- a/cmd/mcvs-stub-server/main_test.go +++ b/cmd/mcvs-stub-server/main_test.go @@ -10,6 +10,19 @@ import ( "github.com/stretchr/testify/assert" ) +func TestHealthHandler(t *testing.T) { + // given + handler := newHandler() + + // when + httptestRecorder := httptest.NewRecorder() + httptestRequest := httptest.NewRequest("GET", "/health", nil) + + // then + handler.health(httptestRecorder, httptestRequest) + assert.Equal(t, http.StatusOK, httptestRecorder.Code) +} + func TestResetHandler(t *testing.T) { // given handler := newHandler()