z_14_e_filetest.gno
0.88 Kb ยท 39 lines
1package main
2
3import (
4 "strings"
5 "testing"
6
7 boards2 "gno.land/r/gnoland/boards2/v1"
8)
9
10const owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
11
12var (
13 bid boards2.BoardID
14 tid, rid boards2.PostID
15)
16
17func init() {
18 testing.SetRealm(testing.NewUserRealm(owner))
19 bid = boards2.CreateBoard(cross, "test-board", false)
20 tid = boards2.CreateThread(cross, bid, "Foo", "bar")
21
22 rid = boards2.CreateReply(cross, bid, tid, 0, "Parent")
23 boards2.CreateReply(cross, bid, tid, rid, "Child reply")
24}
25
26func main() {
27 testing.SetRealm(testing.NewUserRealm(owner))
28
29 boards2.DeleteReply(cross, bid, tid, rid)
30
31 // Render content must contain the releted message instead of reply's body
32 content := boards2.Render("test-board/1/2")
33 println(strings.Contains(content, "\n> This reply has been deleted\n"))
34 println(strings.Contains(content, "\n> > Child reply\n"))
35}
36
37// Output:
38// true
39// true