Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_2_j_filetest.gno

0.88 Kb ยท 45 lines
 1package main
 2
 3import (
 4	"strings"
 5	"testing"
 6
 7	"gno.land/p/gnoland/boards"
 8
 9	boards2 "gno.land/r/boards000/v1rc1"
10)
11
12const (
13	owner   address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
14	path            = "test-board/1/2"
15	comment         = "Second comment"
16)
17
18var (
19	bid      boards.ID
20	tid, rid boards.ID
21)
22
23func init() {
24	testing.SetRealm(testing.NewUserRealm(owner))
25	bid = boards2.CreateBoard(cross, "test-board", false)
26	tid = boards2.CreateThread(cross, bid, "Foo", "bar")
27	rid = boards2.CreateReply(cross, bid, tid, 0, "First comment")
28}
29
30func main() {
31	testing.SetRealm(testing.NewUserRealm(owner))
32
33	rid2 := boards2.CreateReply(cross, bid, tid, rid, comment)
34
35	// Ensure that returned ID is right
36	println(rid2 == 3)
37
38	// Render content must contain the sub-reply
39	content := boards2.Render(path)
40	println(strings.Contains(content, "\n> > "+comment+"\n"))
41}
42
43// Output:
44// true
45// true