oficina / sheets Public

Clone
git clone https://amadan.net/oficina/sheets

Plain git — no account needed to clone.

Download

Download this file

1package sheets
2
3import (
4 "net/http"
5 "net/http/httptest"
6 "testing"
7)
8
9// TestHealthz exercises App.Router()'s own /healthz in isolation via
10// httptest — it does NOT prove what a deployed instance answers. In
11// production rastrillo.Serve's outer mux registers its own GET /healthz
12// ahead of this one and wins (see the comment on Router in app.go); this
13// test only proves the app's router itself is wired and reachable.
14func TestHealthz(t *testing.T) {
15 app := New(Config{})
16 req := httptest.NewRequest(http.MethodGet, "/healthz", nil)
17 rec := httptest.NewRecorder()
18 app.Router().ServeHTTP(rec, req)
19 if rec.Code != http.StatusOK {
20 t.Fatalf("healthz = %d, want 200", rec.Code)
21 }
22}
23