z_10_g_filetest.gno

0.99 Kb ยท 41 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	boards2 "gno.land/r/gnoland/boards2/v1"
 7)
 8
 9const (
10	owner     = address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
11	moderator = address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj") // @test2
12)
13
14var (
15	bid boards2.BoardID
16	pid boards2.PostID
17)
18
19func init() {
20	// Created a board with a specific flagging threshold
21	testing.SetRealm(testing.NewUserRealm(owner))
22	bid = boards2.CreateBoard(cross, "test-board", false)
23	boards2.SetFlaggingThreshold(cross, bid, 2)
24
25	// Invite a moderator to the new board
26	boards2.InviteMember(cross, bid, moderator, boards2.RoleModerator)
27
28	// Create a new thread and flag it as a moderator
29	testing.SetRealm(testing.NewUserRealm(moderator))
30	pid = boards2.CreateThread(cross, bid, "Foo", "bar")
31	boards2.FlagThread(cross, bid, pid, "")
32}
33
34func main() {
35	testing.SetRealm(testing.NewUserRealm(moderator))
36
37	boards2.FlagThread(cross, bid, pid, "")
38}
39
40// Error:
41// item has been already flagged by g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj