z_13_a_filetest.gno

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