Skip to content

Commit

Permalink
Add IPAddressRegistry field to test
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkushinDaniil committed Jan 1, 2025
1 parent d1397f0 commit 06a7460
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion l1/l1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/NethermindEth/juno/l1"
"github.com/NethermindEth/juno/l1/contract"
"github.com/NethermindEth/juno/mocks"
"github.com/NethermindEth/juno/p2p"
"github.com/NethermindEth/juno/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
Expand Down Expand Up @@ -110,6 +111,7 @@ func TestEventListener(t *testing.T) {
ctrl := gomock.NewController(t)
nopLog := utils.NewNopZapLogger()
network := utils.Mainnet
network.IPAddressRegistry = &common.Address{}
chain := blockchain.New(pebble.NewMemTest(t), &network, nil)

subscriber := mocks.NewMockSubscriber(ctrl)
Expand All @@ -126,6 +128,24 @@ func TestEventListener(t *testing.T) {
Return(newFakeSubscription(), nil).
Times(1)

subscriber.
EXPECT().
GetIPAddresses(gomock.Any(), gomock.Any()).
Return([]string{}, nil).
Times(1)

subscriber.
EXPECT().
WatchIPAdded(gomock.Any(), gomock.Any()).
Return(newFakeSubscription(), nil).
Times(1)

subscriber.
EXPECT().
WatchIPRemoved(gomock.Any(), gomock.Any()).
Return(newFakeSubscription(), nil).
Times(1)

subscriber.
EXPECT().
FinalisedHeight(gomock.Any()).
Expand All @@ -141,7 +161,7 @@ func TestEventListener(t *testing.T) {
subscriber.EXPECT().Close().Times(1)

var got *core.L1Head
client := l1.NewClient(subscriber, chain, nopLog, nil).
client := l1.NewClient(subscriber, chain, nopLog, make(chan<- p2p.IPAddressRegistryEvent)).
WithResubscribeDelay(0).
WithPollFinalisedInterval(time.Nanosecond).
WithEventListener(l1.SelectiveListener{
Expand Down

0 comments on commit 06a7460

Please sign in to comment.