Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_10_h_filetest.gno

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