Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_9_e_filetest.gno

0.79 Kb ยท 38 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	pid boards2.PostID
17)
18
19func init() {
20	testing.SetRealm(testing.NewUserRealm(owner))
21	bid = boards2.CreateBoard(cross, "test-board", false)
22	pid = boards2.CreateThread(cross, bid, "Foo", "bar")
23
24	// Invite a member using a role with permission to delete threads
25	boards2.InviteMember(cross, bid, member, boards2.RoleAdmin)
26}
27
28func main() {
29	testing.SetRealm(testing.NewUserRealm(member))
30
31	boards2.DeleteThread(cross, bid, pid)
32
33	// Ensure thread doesn't exist
34	println(boards2.Render("test-board/1"))
35}
36
37// Output:
38// Thread does not exist with ID: 1