z_10_f_filetest.gno

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