github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/tendermint/rpc/grpc/grpc_test.go (about) 1 package coregrpc_test 2 3 import ( 4 "context" 5 "os" 6 "testing" 7 8 "github.com/fibonacci-chain/fbc/libs/tendermint/abci/example/kvstore" 9 core_grpc "github.com/fibonacci-chain/fbc/libs/tendermint/rpc/grpc" 10 rpctest "github.com/fibonacci-chain/fbc/libs/tendermint/rpc/test" 11 "github.com/stretchr/testify/require" 12 ) 13 14 func TestMain(m *testing.M) { 15 // start a tendermint node in the background to test against 16 app := kvstore.NewApplication() 17 node := rpctest.StartTendermint(app) 18 19 code := m.Run() 20 21 // and shut down proper at the end 22 rpctest.StopTendermint(node) 23 os.Exit(code) 24 } 25 26 func TestBroadcastTx(t *testing.T) { 27 res, err := rpctest.GetGRPCClient().BroadcastTx( 28 context.Background(), 29 &core_grpc.RequestBroadcastTx{Tx: []byte("this is a tx")}, 30 ) 31 require.NoError(t, err) 32 require.EqualValues(t, 0, res.CheckTx.Code) 33 require.EqualValues(t, 0, res.DeliverTx.Code) 34 }