Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_14_g_filetest.gno

0.86 Kb ยท 39 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	member address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
12)
13
14var (
15	bid      boards2.BoardID
16	tid, rid boards2.PostID
17)
18
19func init() {
20	testing.SetRealm(testing.NewUserRealm(owner))
21	bid = boards2.CreateBoard(cross, "test-board", false)
22	tid = boards2.CreateThread(cross, bid, "Foo", "bar")
23	rid = boards2.CreateReply(cross, bid, tid, 0, "body")
24
25	// Invite a member using a role with permission to delete replies
26	boards2.InviteMember(cross, bid, member, boards2.RoleAdmin)
27}
28
29func main() {
30	testing.SetRealm(testing.NewUserRealm(member))
31
32	boards2.DeleteReply(cross, bid, tid, rid)
33
34	// Ensure reply doesn't exist
35	println(boards2.Render("test-board/1/2"))
36}
37
38// Output:
39// Reply does not exist with ID: 2