Search Apps Documentation Source Content File Folder Download Copy

pages_test.gno

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