z_12_b_filetest.gno
0.90 Kb ยท 44 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
28 // Create a reply and a sub reply
29 parentRID := boards2.CreateReply(cross, bid, tid, 0, "Parent")
30 rid = boards2.CreateReply(cross, bid, tid, parentRID, "Child")
31}
32
33func main() {
34 testing.SetRealm(testing.NewUserRealm(owner))
35
36 boards2.EditReply(cross, bid, tid, rid, body)
37
38 // Render content must contain the modified reply
39 content := boards2.Render(path)
40 println(strings.Contains(content, "\n> > "+body+"\n"))
41}
42
43// Output:
44// true