Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_10_a_filetest.gno

0.93 Kb ยท 43 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/gnoland/boards"
 7
 8	boards2 "gno.land/r/gnoland/boards2/v1"
 9	"gno.land/r/gnoland/boards2/v1/permissions"
10)
11
12const (
13	owner     address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
14	moderator address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
15)
16
17var (
18	bid boards.ID
19	pid boards.ID
20)
21
22func init() {
23	testing.SetRealm(testing.NewUserRealm(owner))
24	bid = boards2.CreateBoard(cross, "test-board", false, false)
25
26	// Invite a moderator to the new board
27	boards2.InviteMember(cross, bid, moderator, permissions.RoleModerator)
28
29	// Create a new thread as a moderator
30	pid = boards2.CreateThread(cross, bid, "Foo", "bar")
31}
32
33func main() {
34	testing.SetRealm(testing.NewUserRealm(owner))
35
36	boards2.FlagThread(cross, bid, pid, "")
37
38	// Ensure that original thread content not visible
39	println(boards2.Render("test-board/1"))
40}
41
42// Output:
43// Thread with ID: 1 has been flagged as inappropriate