MCPcopy Create free account
hub / github.com/BryanMwangi/pine / TestRender_HTML_CustomStatus

Function TestRender_HTML_CustomStatus

render/engine_test.go:88–105  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

86}
87
88func TestRender_HTML_CustomStatus(t *testing.T) {
89 dir := makeViewDir(t, map[string]string{
90 "404.html": `<h1>Not Found</h1>`,
91 })
92
93 server := setupServer(t, dir)
94 server.Get("/missing", func(c *pine.Ctx) error {
95 return c.Render("404.html", nil, http.StatusNotFound)
96 })
97
98 req := httptest.NewRequest(http.MethodGet, "/missing", nil)
99 rr := httptest.NewRecorder()
100 server.ServeHTTP(rr, req)
101
102 if rr.Code != http.StatusNotFound {
103 t.Errorf("expected 404, got %d", rr.Code)
104 }
105}
106
107func TestRender_HTML_SharedPartial(t *testing.T) {
108 dir := makeViewDir(t, map[string]string{

Callers

nothing calls this directly

Calls 5

makeViewDirFunction · 0.85
setupServerFunction · 0.85
ServeHTTPMethod · 0.80
RenderMethod · 0.65
GetMethod · 0.45

Tested by

no test coverage detected