Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
increase test coverage
Browse files Browse the repository at this point in the history
rachit77 committed Nov 28, 2024
1 parent fe419bf commit 9a6211e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions synchronizer/batches_test.go
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import (
"math/big"
"strings"
"testing"
"time"

elderberryValidium "github.com/0xPolygon/cdk-contracts-tooling/contracts/elderberry/polygonvalidiumetrog"
etrogValidium "github.com/0xPolygon/cdk-contracts-tooling/contracts/etrog/polygonvalidiumetrog"
@@ -495,6 +496,28 @@ func TestBatchSynchronizer_HandleEvent(t *testing.T) {
})
}

func TestBatchSynchronizer_ProcessMissingBatches(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
dbMock := mocks.NewDB(t)
dbMock.On("GetMissingBatchKeys", mock.Anything, mock.Anything).Return(
[]types.BatchKey{}, nil)

batchSynronizer := &BatchSynchronizer{
db: dbMock,
retry: time.Millisecond * 100,
stop: make(chan struct{}),
}
go batchSynronizer.processMissingBatches(ctx)

// Wait for the retry interval and then signal to stop
time.Sleep(time.Millisecond * 200)
batchSynronizer.stop <- struct{}{}
dbMock.AssertExpectations(t)
}

func TestBatchSynchronizer_HandleMissingBatches(t *testing.T) {
t.Parallel()

0 comments on commit 9a6211e

Please sign in to comment.