pages_test.gno
1.04 Kb ยท 46 lines
1package gnopages
2
3import (
4 "strings"
5 "testing"
6)
7
8func TestHome(t *testing.T) {
9 printedOnce := false
10 got := Render("")
11
12 expectedSubtrings := []string{
13 "/r/gnoland/pages:p/tokenomics",
14 "/r/gnoland/pages:p/links",
15 "/r/gnoland/pages:p/contribute",
16 "/r/gnoland/pages:p/start",
17 "/r/gnoland/pages:p/about",
18 "/r/gnoland/pages:p/gnolang",
19 }
20
21 for _, substring := range expectedSubtrings {
22 if !strings.Contains(got, substring) {
23 if !printedOnce {
24 printedOnce = true
25 }
26 t.Errorf("expected %q, but not found.", substring)
27 }
28 }
29}
30
31func TestAbout(t *testing.T) {
32 printedOnce := false
33 got := Render("p/about")
34 expectedSubtrings := []string{
35 "Gno.land Is A Platform To Write Smart Contracts In Gno",
36 "Gno.land is a next-generation smart contract platform using Gno, an interpreted version of the general-purpose Go\nprogramming language.",
37 }
38 for _, substring := range expectedSubtrings {
39 if !strings.Contains(got, substring) {
40 if !printedOnce {
41 printedOnce = true
42 }
43 t.Errorf("expected %q, but not found.", substring)
44 }
45 }
46}