Skip to content

Commit

Permalink
refactor part 2 for the IsInterfaceNil tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iulianpascalau committed Mar 31, 2023
1 parent d4ab76f commit b9953f4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
5 changes: 2 additions & 3 deletions node/external/logs/logsFacade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-core-go/marshal"
"github.com/multiversx/mx-chain-go/testscommon"
Expand Down Expand Up @@ -149,13 +148,13 @@ func TestLogsFacade_IsInterfaceNil(t *testing.T) {
t.Parallel()

var lf *logsFacade
require.True(t, check.IfNil(lf))
require.True(t, lf.IsInterfaceNil())

arguments := ArgsNewLogsFacade{
StorageService: genericMocks.NewChainStorerMock(7),
Marshaller: &marshal.GogoProtoMarshalizer{},
PubKeyConverter: testscommon.NewPubkeyConverterMock(32),
}
lf, _ = NewLogsFacade(arguments)
require.False(t, check.IfNil(lf))
require.False(t, lf.IsInterfaceNil())
}
5 changes: 2 additions & 3 deletions node/external/nodeApiResolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"math/big"
"testing"

"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/data/api"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-go/common"
Expand Down Expand Up @@ -681,9 +680,9 @@ func TestNodeApiResolver_IsInterfaceNil(t *testing.T) {
t.Parallel()

nar, _ := external.NewNodeApiResolver(external.ArgNodeApiResolver{})
require.True(t, check.IfNil(nar))
require.True(t, nar.IsInterfaceNil())

arg := createMockArgs()
nar, _ = external.NewNodeApiResolver(arg)
require.False(t, check.IfNil(nar))
require.False(t, nar.IsInterfaceNil())
}
5 changes: 2 additions & 3 deletions node/external/timemachine/fee/feeComputer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"sync"
"testing"

"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/process"
Expand Down Expand Up @@ -221,13 +220,13 @@ func TestFeeComputer_IsInterfaceNil(t *testing.T) {
t.Parallel()

var fc *feeComputer
require.True(t, check.IfNil(fc))
require.True(t, fc.IsInterfaceNil())

arguments := ArgsNewFeeComputer{
BuiltInFunctionsCostHandler: &testscommon.BuiltInCostHandlerStub{},
EconomicsConfig: testscommon.GetEconomicsConfig(),
}

fc, _ = NewFeeComputer(arguments)
require.False(t, check.IfNil(fc))
require.False(t, fc.IsInterfaceNil())
}
4 changes: 2 additions & 2 deletions node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4509,8 +4509,8 @@ func TestNode_IsInterfaceNil(t *testing.T) {
t.Parallel()

var n *node.Node
require.True(t, check.IfNil(n))
require.True(t, n.IsInterfaceNil())

n, _ = node.NewNode()
require.False(t, check.IfNil(n))
require.False(t, n.IsInterfaceNil())
}
5 changes: 2 additions & 3 deletions node/trieIterators/delegatedListProcessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"testing"
"time"

"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/core/keyValStorage"
"github.com/multiversx/mx-chain-core-go/data/api"
"github.com/multiversx/mx-chain-go/common"
Expand Down Expand Up @@ -216,10 +215,10 @@ func TestDelegatedListProcessor_IsInterfaceNil(t *testing.T) {
t.Parallel()

var dlp *delegatedListProcessor
require.True(t, check.IfNil(dlp))
require.True(t, dlp.IsInterfaceNil())

dlp, _ = NewDelegatedListProcessor(createMockArgs())
require.False(t, check.IfNil(dlp))
require.False(t, dlp.IsInterfaceNil())
}

func createDelegationScAccount(address []byte, leaves [][]byte, rootHash []byte, timeSleep time.Duration) state.UserAccountHandler {
Expand Down
5 changes: 2 additions & 3 deletions node/trieIterators/directStakedListProcessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"testing"
"time"

"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/core/keyValStorage"
"github.com/multiversx/mx-chain-core-go/data/api"
"github.com/multiversx/mx-chain-go/common"
Expand Down Expand Up @@ -171,8 +170,8 @@ func TestDirectStakedListProcessor_IsInterfaceNil(t *testing.T) {
t.Parallel()

var dslp *directStakedListProcessor
require.True(t, check.IfNil(dslp))
require.True(t, dslp.IsInterfaceNil())

dslp, _ = NewDirectStakedListProcessor(createMockArgs())
require.False(t, check.IfNil(dslp))
require.False(t, dslp.IsInterfaceNil())
}

0 comments on commit b9953f4

Please sign in to comment.