Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

zz_links_test.gno

0.59 Kb · 22 lines
 1package connect4
 2
 3import (
 4	"strings"
 5	"testing"
 6
 7	"gno.land/p/nt/testutils/v0"
 8	"gno.land/p/nt/uassert/v0"
 9)
10
11// The game list links each game to this realm's own page. It once linked
12// to the malformed gno.land/r:<id>.
13func TestListLinksNameThisRealm(cur realm, t *testing.T) {
14	testing.SetRealm(testing.NewUserRealm(testutils.TestAddress("red")))
15	id := NewGame(cross(cur), testutils.TestAddress("yellow"))
16	out := Render("")
17	s := ""
18	for n := id; n > 0; n /= 10 {
19		s = string(rune(byte(n%10)+byte(48))) + s
20	}
21	uassert.True(t, strings.Contains(out, "](/r/moul/x/daily/connect4/v1:"+s+")"), out)
22}