github.com/anycable/anycable-go@v1.5.1/server/health_handler_test.go (about)

     1  package server
     2  
     3  import (
     4  	"net/http"
     5  	"net/http/httptest"
     6  	"testing"
     7  
     8  	"github.com/stretchr/testify/assert"
     9  )
    10  
    11  func TestHealthHandler(t *testing.T) {
    12  	req, err := http.NewRequest("GET", "/health", nil)
    13  	if err != nil {
    14  		t.Fatal(err)
    15  	}
    16  
    17  	rr := httptest.NewRecorder()
    18  	handler := http.HandlerFunc(HealthHandler)
    19  
    20  	handler.ServeHTTP(rr, req)
    21  
    22  	assert.Equal(t, http.StatusOK, rr.Code)
    23  }