package server import ( "encoding/json" "net/http" "net/http/httptest" "testing" ) func TestHandleStatus(t *testing.T) { request, _ := http.NewRequest(http.MethodGet, "/status", nil) response := httptest.NewRecorder() s := NewServer(8080) s.Initialise() s.HandleStatus(response, request) var status StatusResponse json.NewDecoder(response.Body).Decode(&status) if status.Ready != true { t.Errorf("got false for /status") } }