z_9_e_filetest.gno
0.86 Kb ยท 41 lines
1package main
2
3import (
4 "testing"
5
6 "gno.land/p/gnoland/boards"
7
8 boards2 "gno.land/r/gnoland/boards2/v1"
9 "gno.land/r/gnoland/boards2/v1/permissions"
10)
11
12const (
13 owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
14 member address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
15)
16
17var (
18 bid boards.ID
19 pid boards.ID
20)
21
22func init() {
23 testing.SetRealm(testing.NewUserRealm(owner))
24 bid = boards2.CreateBoard(cross, "test-board", false, false)
25 pid = boards2.CreateThread(cross, bid, "Foo", "bar")
26
27 // Invite a member using a role with permission to delete threads
28 boards2.InviteMember(cross, bid, member, permissions.RoleAdmin)
29}
30
31func main() {
32 testing.SetRealm(testing.NewUserRealm(member))
33
34 boards2.DeleteThread(cross, bid, pid)
35
36 // Ensure thread doesn't exist
37 println(boards2.Render("test-board/1"))
38}
39
40// Output:
41// Thread does not exist with ID: 1