fee_collector_test.gno
0.96 Kb · 40 lines
1package params
2
3import (
4 "testing"
5
6 "gno.land/p/nt/urequire/v0"
7 "gno.land/r/gov/dao"
8)
9
10// cur is a zero-value realm used as a placeholder when forwarding to
11// uassert/urequire dispatch helpers that gained an `rlm realm` param.
12// These tests pass `func()` callbacks (no crossing inside the callback),
13// so rlm is ignored — a nil realm here is safe.
14var cur realm
15
16func TestSetFeeCollector(cur realm, t *testing.T) {
17 userRealm := testing.NewUserRealm(g1user)
18 testing.SetRealm(userRealm)
19
20 pr := NewSetFeeCollectorRequest(cur, userRealm.Address())
21 id := dao.MustCreateProposal(cross(cur), pr)
22 _, err := dao.GetProposal(id)
23 urequire.NoError(t, err)
24
25 urequire.NotPanics(
26 t, cur,
27 func() {
28 dao.MustVoteOnProposal(cross(cur), dao.NewVoteRequest(dao.YesVote, dao.ProposalID(id)))
29 },
30 )
31
32 urequire.NotPanics(
33 t, cur,
34 func() {
35 dao.ExecuteProposal(cross(cur), id)
36 },
37 )
38
39 // XXX: test that the value got properly updated, when we can get params from gno code
40}