Skip to content

Commit 566df29

Browse files
committed
chore_: test fixes
1 parent 0bdb88a commit 566df29

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

rpc/client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ func NewClient(config ClientConfig) (*Client, error) {
159159
}
160160

161161
func (c *Client) Start(ctx context.Context) {
162-
c.signalsTransmitter.Start()
162+
if err := c.signalsTransmitter.Start(); err != nil {
163+
c.logger.Error("Failed to start signals transmitter", zap.Error(err))
164+
}
163165
c.networkManager.Start()
164166

165167
if c.stopMonitoringFunc != nil {

services/wallet/keycard_pairings_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/status-im/status-go/params"
1212
"github.com/status-im/status-go/pkg/pubsub"
1313
"github.com/status-im/status-go/rpc"
14-
"github.com/status-im/status-go/rpc/network"
1514
"github.com/status-im/status-go/t/helpers"
1615
"github.com/status-im/status-go/walletdatabase"
1716
)
@@ -28,7 +27,12 @@ func TestKeycardPairingsFile(t *testing.T) {
2827

2928
accountsPublisher := pubsub.NewPublisher()
3029

31-
service := NewService(db, accountsDb, appDB, &rpc.Client{NetworkManager: network.NewManager(db, nil)}, accountsPublisher, nil, nil, &params.NodeConfig{}, nil, nil, nil, nil, "")
30+
rpcClient, err := rpc.NewClient(rpc.ClientConfig{
31+
DB: db,
32+
AccountsPublisher: accountsPublisher,
33+
})
34+
require.NoError(t, err)
35+
service := NewService(db, accountsDb, appDB, rpcClient, accountsPublisher, nil, nil, &params.NodeConfig{}, nil, nil, nil, nil, "")
3236

3337
data, err := service.KeycardPairings().GetPairingsJSONFileContent()
3438
require.NoError(t, err)

services/wallet/reader_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/ethereum/go-ethereum/common"
1717
"github.com/ethereum/go-ethereum/common/hexutil"
1818
"github.com/ethereum/go-ethereum/event"
19+
"github.com/status-im/status-go/healthmanager/rpcstatus"
1920
"github.com/status-im/status-go/rpc/chain"
2021
mock_client "github.com/status-im/status-go/rpc/chain/mock/client"
2122
"github.com/status-im/status-go/services/wallet/testutils"
@@ -885,8 +886,8 @@ func TestGetCachedBalances(t *testing.T) {
885886
expectedChains := []uint64{1, 2}
886887
tokenManager.EXPECT().GetTokensByChainIDs(testutils.NewUint64SliceMatcher(expectedChains)).Return(allTokens, nil)
887888
tokenManager.EXPECT().GetTokenHistoricalBalance(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil)
888-
mockClientIface1.EXPECT().IsConnected().Return(true)
889-
mockClientIface2.EXPECT().IsConnected().Return(true)
889+
mockClientIface1.EXPECT().GetConnectionStatus().Return(rpcstatus.StatusUp)
890+
mockClientIface2.EXPECT().GetConnectionStatus().Return(rpcstatus.StatusUp)
890891
tokens, err := reader.GetCachedBalances(clients, addresses)
891892
require.NoError(t, err)
892893

@@ -1012,8 +1013,8 @@ func TestFetchBalances(t *testing.T) {
10121013

10131014
tokenAddresses := getTokenAddresses(allTokens)
10141015
tokenManager.EXPECT().GetBalancesByChain(context.TODO(), clients, addresses, testutils.NewAddressSliceMatcher(tokenAddresses)).Return(expectedBalances, nil)
1015-
mockClientIface1.EXPECT().IsConnected().Return(true)
1016-
mockClientIface2.EXPECT().IsConnected().Return(true)
1016+
mockClientIface1.EXPECT().GetConnectionStatus().Return(rpcstatus.StatusUp)
1017+
mockClientIface2.EXPECT().GetConnectionStatus().Return(rpcstatus.StatusUp)
10171018
tokens, err := reader.FetchBalances(context.TODO(), clients, addresses)
10181019
require.NoError(t, err)
10191020

services/wallet/transfer/commands_sequential_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ import (
1212
"testing"
1313
"time"
1414

15+
"github.com/status-im/status-go/contracts"
16+
"github.com/status-im/status-go/healthmanager/rpcstatus"
17+
"github.com/status-im/status-go/services/wallet/blockchainstate"
18+
"github.com/status-im/status-go/services/wallet/token/token-lists/fetcher"
19+
"github.com/status-im/status-go/t/utils"
20+
1521
"github.com/pkg/errors"
1622
"github.com/stretchr/testify/mock"
1723
"github.com/stretchr/testify/require"
@@ -703,12 +709,12 @@ func (tc *TestClient) SetIsConnected(value bool) {
703709
}
704710
}
705711

706-
func (tc *TestClient) IsConnected() bool {
712+
func (tc *TestClient) GetConnectionStatus() rpcstatus.StatusType {
707713
if tc.traceAPICalls {
708-
tc.t.Log("GetIsConnected")
714+
tc.t.Log("GetConnectionStatus")
709715
}
710716

711-
return true
717+
return rpcstatus.StatusUp
712718
}
713719

714720
func (tc *TestClient) GetLimiter() rpclimiter.RequestLimiter {

0 commit comments

Comments
 (0)