Added test coverage for template renderer.

This commit is contained in:
mikestefanello 2021-12-25 11:21:26 -05:00
parent 6501621136
commit 388718598e
6 changed files with 183 additions and 35 deletions

View file

@ -15,6 +15,7 @@ import (
echomw "github.com/labstack/echo/v4/middleware"
)
// BuildRouter builds the router
func BuildRouter(c *services.Container) {
// Static files with proper cache control
// funcmap.File() should be used in templates to append a cache key to the URL in order to break cache
@ -58,7 +59,7 @@ func BuildRouter(c *services.Container) {
err := Error{Controller: ctr}
c.Web.HTTPErrorHandler = err.Get
// Routes
// Example routes
navRoutes(c, g, ctr)
userRoutes(c, g, ctr)
}

View file

@ -102,8 +102,8 @@ func (h *httpResponse) assertStatusCode(code int) *httpResponse {
return h
}
func (h *httpResponse) assertRedirect(t *testing.T, destination string) *httpResponse {
assert.Equal(t, destination, h.Header.Get("Location"))
func (h *httpResponse) assertRedirect(t *testing.T, route string, params ...interface{}) *httpResponse {
assert.Equal(t, c.Web.Reverse(route, params), h.Header.Get("Location"))
return h
}