github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/std/doc_test.go (about) 1 package std 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 "github.com/stretchr/testify/require" 8 ) 9 10 func TestSignDoc_GetSignaturePayload(t *testing.T) { 11 t.Parallel() 12 13 testTable := []struct { 14 name string 15 doc SignDoc 16 }{ 17 { 18 "empty sign doc", 19 SignDoc{}, 20 }, 21 { 22 "non-empty sign doc", 23 SignDoc{ 24 ChainID: "dummy", 25 AccountNumber: 10, 26 Sequence: 20, 27 Fee: Fee{ 28 GasFee: NewCoin("ugnot", 10), 29 GasWanted: 10, 30 }, 31 Msgs: []Msg{}, 32 Memo: "totally valid transaction", 33 }, 34 }, 35 } 36 37 for _, testCase := range testTable { 38 testCase := testCase 39 40 t.Run(testCase.name, func(t *testing.T) { 41 t.Parallel() 42 43 signPayload, err := GetSignaturePayload(testCase.doc) 44 require.NoError(t, err) 45 46 assert.NotNil(t, signPayload) 47 assert.NotEmpty(t, signPayload) 48 }) 49 } 50 }