mirror of
https://github.com/kevin-DL/football_info_api.git
synced 2026-01-22 14:35:29 +00:00
Initial commit
This commit is contained in:
24
main_test.go
Normal file
24
main_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
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())
|
||||
}
|
||||
Reference in New Issue
Block a user