github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/r/gnoland/pages/pages_test.gno (about)

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