z_13_g_filetest.gno
1.00 Kb · 41 lines
1package main
2
3import (
4 "strings"
5 "testing"
6
7 boards2 "gno.land/r/gnoland/boards2/v1"
8)
9
10const (
11 owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
12 moderator address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
13)
14
15var (
16 bid boards2.BoardID
17 rid, tid boards2.PostID
18)
19
20func init() {
21 testing.SetRealm(testing.NewUserRealm(owner))
22 bid = boards2.CreateBoard(cross, "test-board", false)
23 tid = boards2.CreateThread(cross, bid, "Foo", "bar")
24 rid = boards2.CreateReply(cross, bid, tid, 0, "body")
25
26 // Invite a member using a role with permission to flag replies
27 boards2.InviteMember(cross, bid, moderator, boards2.RoleModerator)
28}
29
30func main() {
31 testing.SetRealm(testing.NewUserRealm(moderator))
32
33 boards2.FlagReply(cross, bid, tid, rid, "")
34
35 // Render content must contain a message about the hidden reply
36 content := boards2.Render("test-board/1/2")
37 println(strings.Contains(content, "\n> *⚠ Reply is hidden as it has been flagged as inappropriate*\n"))
38}
39
40// Output:
41// true