diff --git a/node/full_node_test.go b/node/full_node_test.go index 79ae58a494..54abe8c52c 100644 --- a/node/full_node_test.go +++ b/node/full_node_test.go @@ -27,14 +27,17 @@ import ( // simply check that node is starting and stopping without panicking func TestStartup(t *testing.T) { ctx := context.Background() - _ = initAndStartNodeWithCleanup(ctx, t, "full").(*FullNode) + node := initAndStartNodeWithCleanup(ctx, t, "full") + require.IsType(t, new(FullNode), node) } func TestMempoolDirectly(t *testing.T) { ctx := context.Background() - node := initAndStartNodeWithCleanup(ctx, t, "full").(*FullNode) + fn := initAndStartNodeWithCleanup(ctx, t, "full") + require.IsType(t, new(FullNode), fn) + node := fn.(*FullNode) assert := assert.New(t) peerID := getPeerID(assert) verifyTransactions(node, peerID, assert) diff --git a/node/light_client_test.go b/node/light_client_test.go index 4d731a5a1a..5f4c9a8ffe 100644 --- a/node/light_client_test.go +++ b/node/light_client_test.go @@ -6,6 +6,7 @@ import ( rpcclient "github.com/cometbft/cometbft/rpc/client" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) // TestLightClient_Panics tests that all methods of LightClient and ensures that @@ -16,7 +17,8 @@ import ( func TestLightClient_Panics(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - ln := initAndStartNodeWithCleanup(ctx, t, "light").(*LightNode) + ln := initAndStartNodeWithCleanup(ctx, t, "light") + require.IsType(t, new(LightNode), ln) tests := []struct { name string diff --git a/node/node_test.go b/node/node_test.go index 0f5d08e3e9..8576a15256 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -81,6 +81,8 @@ func newTestNode(ctx context.Context, t *testing.T, nodeType string) (Node, ed25 func TestNewNode(t *testing.T) { ctx := context.Background() - _ = initAndStartNodeWithCleanup(ctx, t, "light").(*LightNode) - _ = initAndStartNodeWithCleanup(ctx, t, "full").(*FullNode) + ln := initAndStartNodeWithCleanup(ctx, t, "light") + require.IsType(t, new(LightNode), ln) + fn := initAndStartNodeWithCleanup(ctx, t, "full") + require.IsType(t, new(FullNode), fn) }