Files
football_info_api/main_test.go
2023-07-02 15:26:53 +01:00

25 lines
527 B
Go

package main
import (
"football_api/general"
"github.com/stretchr/testify/require"
"net/http"
"testing"
)
func TestHealth(t *testing.T) {
s := CreateServer(nil)
// Create a New Request
req, _ := http.NewRequest("GET", "/health", nil)
// Execute Request
response := general.ExecuteRequest(req, s)
// Check the response code
general.CheckResponseCode(t, http.StatusOK, response.Code)
// We can use testify/require to assert values, as it is more convenient
require.Equal(t, "\"OK\"", response.Body.String())
}