z_10_g_filetest.gno
0.99 Kb ยท 42 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 // Created a board with a specific flagging threshold
22 testing.SetRealm(std.NewUserRealm(owner))
23 bid = boards2.CreateBoard(cross, "test-board", false)
24 boards2.SetFlaggingThreshold(cross, bid, 2)
25
26 // Invite a moderator to the new board
27 boards2.InviteMember(cross, bid, moderator, boards2.RoleModerator)
28
29 // Create a new thread and flag it as a moderator
30 testing.SetRealm(std.NewUserRealm(moderator))
31 pid = boards2.CreateThread(cross, bid, "Foo", "bar")
32 boards2.FlagThread(cross, bid, pid, "")
33}
34
35func main() {
36 testing.SetRealm(std.NewUserRealm(moderator))
37
38 boards2.FlagThread(cross, bid, pid, "")
39}
40
41// Error:
42// item has been already flagged by g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj