z_0_filetest.gno

0.99 Kb ยท 47 lines
 1package main
 2
 3import (
 4	"std"
 5	"testing"
 6
 7	"gno.land/p/demo/testutils"
 8	"gno.land/r/gnoland/users"
 9	"gno.land/r/gov/dao"
10	"gno.land/r/gov/dao/v3/init"
11)
12
13var (
14	alice = testutils.TestAddress("g1alice")
15)
16
17func init() {
18	testing.SetRealm(std.NewUserRealm(alice))
19	c := std.OriginCaller()
20	init.InitWithUsers(c)
21
22	pReq := users.ProposeNewRelease("gno.land/r/gnoland/users/v2", "This is a note!")
23
24	cross(dao.MustCreateProposal)(pReq)
25}
26
27func main() {
28	testing.SetRealm(std.NewUserRealm(alice))
29
30	cross(dao.MustVoteOnProposal)(dao.VoteRequest{
31		Option:     dao.YesVote,
32		ProposalID: dao.ProposalID(0),
33	})
34
35	cross(dao.ExecuteProposal)(dao.ProposalID(0))
36	println(users.Render(""))
37}
38
39// Output:
40// # r/gnoland/users
41// See the r/gnoland/users changelog below.
42//
43// | Version | Link | Notes |
44// | --- | --- | --- |
45// | v2 | [r/gnoland/users v2 (latest)](/r/gnoland/users/v2) | This is a note! |
46// | v1 | [r/gnoland/users v1](/r/gnoland/users/v1) | [Original PR](https://github.com/gnolang/gno/pull/3166) |
47//