z_13_g_filetest.gno
1.01 Kb · 43 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 (
13 owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
14 moderator address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
15)
16
17var (
18 bid boards.ID
19 rid, tid boards.ID
20)
21
22func init() {
23 testing.SetRealm(testing.NewUserRealm(owner))
24 bid = boards2.CreateBoard(cross, "test-board", false)
25 tid = boards2.CreateThread(cross, bid, "Foo", "bar")
26 rid = boards2.CreateReply(cross, bid, tid, 0, "body")
27
28 // Invite a member using a role with permission to flag replies
29 boards2.InviteMember(cross, bid, moderator, boards2.RoleModerator)
30}
31
32func main() {
33 testing.SetRealm(testing.NewUserRealm(moderator))
34
35 boards2.FlagReply(cross, bid, tid, rid, "")
36
37 // Render content must contain a message about the hidden reply
38 content := boards2.Render("test-board/1/2")
39 println(strings.Contains(content, "\n> *⚠ Reply is hidden as it has been flagged as inappropriate*\n"))
40}
41
42// Output:
43// true