z_12_a_filetest.gno

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