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