Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_12_b_filetest.gno

0.88 Kb ยท 42 lines
 1package main
 2
 3import (
 4	"strings"
 5	"testing"
 6
 7	boards2 "gno.land/r/gnoland/boards2/v1"
 8)
 9
10const (
11	owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
12	body          = "Test reply"
13	path          = "test-board/1/2"
14)
15
16var (
17	bid      boards2.BoardID
18	tid, rid boards2.PostID
19)
20
21func init() {
22	testing.SetRealm(testing.NewUserRealm(owner))
23	bid = boards2.CreateBoard(cross, "test-board", false)
24	tid = boards2.CreateThread(cross, bid, "Foo", "bar")
25
26	// Create a reply and a sub reply
27	parentRID := boards2.CreateReply(cross, bid, tid, 0, "Parent")
28	rid = boards2.CreateReply(cross, bid, tid, parentRID, "Child")
29}
30
31func main() {
32	testing.SetRealm(testing.NewUserRealm(owner))
33
34	boards2.EditReply(cross, bid, tid, rid, body)
35
36	// Render content must contain the modified reply
37	content := boards2.Render(path)
38	println(strings.Contains(content, "\n> > "+body+"\n"))
39}
40
41// Output:
42// true