z_13_a_filetest.gno

0.79 Kb · 36 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	rid, tid 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	rid = boards2.CreateReply(cross, bid, tid, 0, "body")
23}
24
25func main() {
26	testing.SetRealm(std.NewUserRealm(owner))
27
28	boards2.FlagReply(cross, bid, tid, rid, "")
29
30	// Render content must contain a message about the hidden reply
31	content := boards2.Render("test-board/1/2")
32	println(strings.Contains(content, "\n> *⚠ Reply is hidden as it has been flagged as inappropriate*\n"))
33}
34
35// Output:
36// true