Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_8_e_filetest.gno

0.88 Kb · 41 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	"gno.land/r/nt/commondao/v0"
 7)
 8
 9const (
10	owner = address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
11	user  = address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1
12)
13
14var rootID uint64
15
16func init() {
17	// Invite a user to be able to start creating DAOs
18	testing.SetRealm(testing.NewUserRealm(owner))
19	commondao.Invite(cross, user)
20
21	// The origin must be the invited user where invitation
22	// is removed after the first user call to create a DAO
23	testing.SetRealm(testing.NewUserRealm(user))
24
25	// Create root DAO without subDAOs
26	testing.SetRealm(testing.NewCodeRealm("gno.land/r/test"))
27	rootID = commondao.New(cross, "Root DAO").ID()
28}
29
30func main() {
31	testing.SetRealm(testing.NewCodeRealm("gno.land/r/test"))
32
33	iter := commondao.NewIterator(rootID)
34
35	println("Count =", iter.Count())
36	println(iter.Next())
37}
38
39// Output:
40// Count = 0
41// false