z_10_h_filetest.gno
0.92 Kb ยท 38 lines
1package main
2
3import (
4 "testing"
5
6 boards2 "gno.land/r/gnoland/boards2/v1"
7)
8
9const owner = address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
10
11var (
12 bid boards2.BoardID
13 pid boards2.PostID
14)
15
16func init() {
17 // Created a board with flagging threshold greater than 1
18 testing.SetRealm(testing.NewUserRealm(owner))
19 bid = boards2.CreateBoard(cross, "test-board", false)
20 boards2.SetFlaggingThreshold(cross, bid, 2)
21
22 // Create a thread so the realm owner can flag and hide it with a single flag
23 pid = boards2.CreateThread(cross, bid, "Foo", "bar")
24 // Also freeze board to make sure that realm owner can still flag the thread
25 boards2.FreezeBoard(cross, bid)
26}
27
28func main() {
29 testing.SetRealm(testing.NewUserRealm(owner))
30
31 boards2.FlagThread(cross, bid, pid, "")
32
33 // Ensure that original thread content not visible
34 println(boards2.Render("test-board/1"))
35}
36
37// Output:
38// Thread with ID: 1 has been flagged as inappropriate