Expanded HTML examples in the about page template.

This commit is contained in:
mikestefanello 2021-12-25 12:35:13 -05:00
parent 388718598e
commit 334cb1c20e
3 changed files with 66 additions and 44 deletions

View file

@ -7,6 +7,8 @@ import (
"github.com/stretchr/testify/assert"
)
// Simple example of how to test routes and their markup using the test HTTP server spun up within
// this test package
func TestAbout_Get(t *testing.T) {
doc := request(t).
setRoute("about").
@ -14,6 +16,7 @@ func TestAbout_Get(t *testing.T) {
assertStatusCode(http.StatusOK).
toDoc()
// Goquery is an excellent package to use for testing HTML markup
h1 := doc.Find("h1.title")
assert.Len(t, h1.Nodes, 1)
assert.Equal(t, "About", h1.Text())