z_12_b_filetest.gno

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