Search Apps Documentation Source Content File Folder Download Copy Actions Download

zp_3_a_filetest.gno

1.15 Kb · 54 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	pcommondao "gno.land/p/nt/commondao/v0"
 7
 8	"gno.land/r/nt/commondao/v0"
 9)
10
11const (
12	owner = address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
13	user  = address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1
14)
15
16var dao *pcommondao.CommonDAO
17
18func init() {
19	testing.SetRealm(testing.NewUserRealm(owner))
20	commondao.Invite(cross, user)
21
22	testing.SetRealm(testing.NewUserRealm(user))
23	testing.SetRealm(testing.NewCodeRealm("gno.land/r/demo/test"))
24	dao = commondao.New(cross, "Foo")
25	dao.Members().Add(user)
26
27	options := commondao.GetOptions(dao.ID())
28	options.SetAllowDissolutionProposals(true)
29}
30
31func main() {
32	testing.SetRealm(testing.NewUserRealm(user))
33
34	pID := commondao.CreateDissolutionProposal(cross, dao.ID())
35
36	p := dao.ActiveProposals().Get(pID)
37	if p == nil {
38		panic("expected proposal to be created")
39	}
40
41	println(string(p.Status()))
42	println(p.Creator() == user)
43	println(p.Definition().Title() == ("Dissolve DAO: " + dao.Name()))
44	println(p.VotingDeadline())
45	println(p.Definition().Body())
46}
47
48// Output:
49// active
50// true
51// true
52// 2009-02-20 23:31:30 +0000 UTC
53// **DAO:**
54// [Foo](/r/nt/commondao/v0:2)