mirror of
https://github.com/tarampampam/error-pages.git
synced 2024-08-30 18:22:40 +00:00
26 lines
500 B
Go
26 lines
500 B
Go
package version_test
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"gh.tarampamp.am/error-pages/internal/http/handlers/version"
|
|
)
|
|
|
|
func TestServeHTTP(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
var (
|
|
req = httptest.NewRequest(http.MethodGet, "http://testing", http.NoBody)
|
|
rr = httptest.NewRecorder()
|
|
)
|
|
|
|
version.New("\t\n foo@bar ").ServeHTTP(rr, req)
|
|
|
|
assert.Equal(t, rr.Code, http.StatusOK)
|
|
assert.Equal(t, rr.Body.String(), `{"version":"foo@bar"}`)
|
|
}
|