learn-go/snippetbox/cmd/web/handlers_test.go

20 lines
328 B
Go
Raw Normal View History

2024-02-13 20:54:07 +00:00
package main
import (
"net/http"
"snippetbox.chaosfem.tw/internal/assert"
"testing"
2024-02-13 20:54:07 +00:00
)
func TestPing(t *testing.T) {
app := newTestApplication(t)
2024-02-14 21:27:02 +00:00
ts := newTestServer(t, app.routes())
2024-02-14 21:27:02 +00:00
defer ts.Close()
2024-02-13 20:54:07 +00:00
statusCode, _, body := ts.get(t, "/ping")
2024-02-13 20:54:07 +00:00
assert.Equal(t, statusCode, http.StatusOK)
assert.Equal(t, body, "OK")
2024-02-13 20:54:07 +00:00
}