Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_12_a_filetest.gno

0.79 Kb ยท 41 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	body          = "Test reply"
15	path          = "test-board/1/2"
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, "body")
28}
29
30func main() {
31	testing.SetRealm(testing.NewUserRealm(owner))
32
33	boards2.EditReply(cross, bid, tid, rid, body)
34
35	// Render content must contain the modified reply
36	content := boards2.Render(path)
37	println(strings.Contains(content, "\n> "+body+"\n"))
38}
39
40// Output:
41// true