z_14_e_filetest.gno
0.90 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 owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
13
14var (
15 bid boards.ID
16 tid, rid boards.ID
17)
18
19func init() {
20 testing.SetRealm(testing.NewUserRealm(owner))
21 bid = boards2.CreateBoard(cross, "test-board", false)
22 tid = boards2.CreateThread(cross, bid, "Foo", "bar")
23
24 rid = boards2.CreateReply(cross, bid, tid, 0, "Parent")
25 boards2.CreateReply(cross, bid, tid, rid, "Child reply")
26}
27
28func main() {
29 testing.SetRealm(testing.NewUserRealm(owner))
30
31 boards2.DeleteReply(cross, bid, tid, rid)
32
33 // Render content must contain the releted message instead of reply's body
34 content := boards2.Render("test-board/1/2")
35 println(strings.Contains(content, "\n> This reply has been deleted\n"))
36 println(strings.Contains(content, "\n> > Child reply\n"))
37}
38
39// Output:
40// true
41// true