z_23_a_filetest.gno

0.91 Kb ยท 33 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	bid   = boards2.BoardID(0)                                  // Operate on realm DAO instead of individual boards
12)
13
14func init() {
15	testing.SetRealm(testing.NewUserRealm(owner))
16	boards2.InviteMember(cross, bid, "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj", boards2.RoleOwner)
17	boards2.InviteMember(cross, bid, "g1vh7krmmzfua5xjmkatvmx09z37w34lsvd2mxa5", boards2.RoleAdmin)
18}
19
20func main() {
21	testing.SetRealm(testing.NewUserRealm(owner))
22
23	boards2.IterateRealmMembers(0, func(u boards2.User) bool {
24		println(u.Address, string(u.Roles[0]))
25		return false
26	})
27}
28
29// Output:
30// g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq owner
31// g1manfred47kzduec920z88wfr64ylksmdcedlf5 owner
32// g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj owner
33// g1vh7krmmzfua5xjmkatvmx09z37w34lsvd2mxa5 admin