github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/cmd/chain_test.go (about) 1 package cmd 2 3 import ( 4 "testing" 5 6 "github.com/aeternity/aepp-sdk-go/aeternity" 7 "github.com/spf13/cobra" 8 ) 9 10 // Prefixing each test with Example makes go-test check the stdout 11 // For now, just verify that none of the commands segfault. 12 13 func setConfigTestParams() { 14 aeternity.Config.Node.URL = "http://localhost:3013" 15 aeternity.Config.Node.NetworkID = "ae_docker" 16 } 17 18 func TestChainTop(t *testing.T) { 19 setConfigTestParams() 20 emptyCmd := cobra.Command{} 21 err := topFunc(&emptyCmd, []string{}) 22 if err != nil { 23 t.Error(err) 24 } 25 } 26 27 func TestChainBroadcast(t *testing.T) { 28 setConfigTestParams() 29 emptyCmd := cobra.Command{} 30 err := broadcastFunc(&emptyCmd, []string{"tx_+KgLAfhCuEAPX1l3BdFOcLeduH3PPwPV25mETXZE8IBDe6PGuasSEKJeB/cDDm+kW05Cdp38+mpvVSTTPMx7trL/7qxfUr8IuGD4XhYBoQHOp63kcMn5nZ1OQAiAqG8dSbtES2LxGp67ZLvP63P+8wGTcXVlcnkgU3BlY2lmaWNhdGlvbpZyZXNwb25zZSBTcGVjaWZpY2F0aW9uAABkhrXmIPSAAIIB9AHdGxXf"}) 31 if err != nil { 32 t.Error(err) 33 } 34 } 35 36 func TestChainStatus(t *testing.T) { 37 setConfigTestParams() 38 emptyCmd := cobra.Command{} 39 err := statusFunc(&emptyCmd, []string{}) 40 if err != nil { 41 t.Error(err) 42 } 43 } 44 45 func TestChainTtl(t *testing.T) { 46 setConfigTestParams() 47 emptyCmd := cobra.Command{} 48 err := ttlFunc(&emptyCmd, []string{}) 49 if err != nil { 50 t.Error(err) 51 } 52 } 53 54 func TestChainNetworkID(t *testing.T) { 55 setConfigTestParams() 56 emptyCmd := cobra.Command{} 57 err := networkIDFunc(&emptyCmd, []string{}) 58 if err != nil { 59 t.Error(err) 60 } 61 }