z_12_a_filetest.gno

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