Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_1_c_filetest.gno

0.89 Kb ยท 40 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	admin address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
15	user  address = "g1w4ek2u33ta047h6lta047h6lta047h6ldvdwpn"
16	role          = permissions.RoleAdmin
17)
18
19var bid boards.ID // Operate on board DAO
20
21func init() {
22	testing.SetRealm(testing.NewUserRealm(owner))
23	bid = boards2.CreateBoard(cross, "test123", false, false)
24
25	// Add an admin member
26	boards2.InviteMember(cross, bid, admin, permissions.RoleAdmin)
27}
28
29func main() {
30	// Next call will be done by the admin member
31	testing.SetRealm(testing.NewUserRealm(admin))
32
33	boards2.InviteMember(cross, bid, user, role)
34
35	// Check that user is invited
36	println(boards2.HasMemberRole(bid, user, role))
37}
38
39// Output:
40// true