mirror of
https://github.com/kevin-DL/football_info_api.git
synced 2026-01-11 10:04:28 +00:00
25 lines
527 B
Go
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())
|
|
}
|