Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_1_c_filetest.gno

0.83 Kb ยท 39 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/gnoland/boards"
 7
 8	boards2 "gno.land/r/boards000/v1rc1"
 9)
10
11const (
12	owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
13	admin address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
14	user  address = "g1w4ek2u33ta047h6lta047h6lta047h6ldvdwpn"
15	role          = boards2.RoleAdmin
16)
17
18var bid boards.ID // Operate on board DAO
19
20func init() {
21	testing.SetRealm(testing.NewUserRealm(owner))
22	bid = boards2.CreateBoard(cross, "test123", false)
23
24	// Add an admin member
25	boards2.InviteMember(cross, bid, admin, boards2.RoleAdmin)
26}
27
28func main() {
29	// Next call will be done by the admin member
30	testing.SetRealm(testing.NewUserRealm(admin))
31
32	boards2.InviteMember(cross, bid, user, role)
33
34	// Check that user is invited
35	println(boards2.HasMemberRole(bid, user, role))
36}
37
38// Output:
39// true