Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

params_test.gno

1.18 Kb · 40 lines
 1package params
 2
 3import (
 4	"testing"
 5)
 6
 7// These tests cover proposal CONSTRUCTION. Reading a value back is possible --
 8// sys/params exposes typed getters (GetSysParamStrings and friends), which
 9// valset.gno and delegate_test.gno both use, and tests can seed with
10// testing.SetSysParam* -- so add read-back assertions rather than assuming they
11// cannot be written. End-to-end execution is additionally covered by the
12// propX_filetest.gno files under r/gov/dao/.
13
14func TestNewStringPropRequest(cur realm, t *testing.T) {
15	pr := NewSysParamStringPropRequest(cur, "foo", "bar", "baz", "qux")
16	if pr.Title() == "" {
17		t.Errorf("executor shouldn't be nil")
18	}
19}
20
21func TestNewSetHaltRequest(cur realm, t *testing.T) {
22	pr := NewSetHaltRequest(cur, 100_000, "chain/gnoland1.1")
23	if pr.Title() == "" {
24		t.Errorf("proposal title shouldn't be empty")
25	}
26}
27
28func TestNewSetHaltRequestNoVersion(cur realm, t *testing.T) {
29	pr := NewSetHaltRequest(cur, 100_000, "")
30	if pr.Title() == "" {
31		t.Errorf("proposal title shouldn't be empty")
32	}
33}
34
35func TestNewSetHaltRequestCancel(cur realm, t *testing.T) {
36	pr := NewSetHaltRequest(cur, 0, "")
37	if pr.Title() == "" {
38		t.Errorf("proposal title shouldn't be empty")
39	}
40}