2017-11-12 05:37:32 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"net/http/httptest"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestPingRoute(t *testing.T) {
|
|
|
|
router := setupRouter()
|
|
|
|
|
|
|
|
w := httptest.NewRecorder()
|
|
|
|
req, _ := http.NewRequest("GET", "/ping", nil)
|
|
|
|
router.ServeHTTP(w, req)
|
|
|
|
|
2018-08-14 01:51:56 +00:00
|
|
|
assert.Equal(t, http.StatusOK, w.Code)
|
2017-11-12 05:37:32 +00:00
|
|
|
assert.Equal(t, "pong", w.Body.String())
|
|
|
|
}
|