Skip to content

Commit

Permalink
Fixed linter
Browse files Browse the repository at this point in the history
  • Loading branch information
begmaroman committed Jul 15, 2024
1 parent 5f84825 commit a44c5e1
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions synchronizer/batches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,8 @@ func TestBatchSynchronizer_detectOffchainDataGaps(t *testing.T) {
}

testFn := func(t *testing.T, config testConfig) {
t.Helper()

dbMock := mocks.NewDB(t)

if config.detectOffchainDataGapsArgs != nil && config.detectOffchainDataGapsReturns != nil {
Expand Down
46 changes: 46 additions & 0 deletions synchronizer/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
)

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

testError := errors.New("test error")

tests := []struct {
Expand Down Expand Up @@ -50,7 +52,11 @@ func Test_getStartBlock(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
t.Parallel()

testDB := tt.db(t)

if block, err := getStartBlock(context.Background(), testDB, L1SyncTask); tt.wantErr {
Expand All @@ -64,6 +70,8 @@ func Test_getStartBlock(t *testing.T) {
}

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

testError := errors.New("test error")

tests := []struct {
Expand Down Expand Up @@ -101,7 +109,11 @@ func Test_setStartBlock(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
t.Parallel()

testDB := tt.db(t)

if err := setStartBlock(context.Background(), testDB, tt.block, L1SyncTask); tt.wantErr {
Expand All @@ -114,6 +126,8 @@ func Test_setStartBlock(t *testing.T) {
}

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

testError := errors.New("test error")
testData := []types.BatchKey{
{
Expand Down Expand Up @@ -155,7 +169,11 @@ func Test_storeUnresolvedBatchKeys(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
t.Parallel()

testDB := tt.db(t)

if err := storeUnresolvedBatchKeys(context.Background(), testDB, tt.keys); tt.wantErr {
Expand All @@ -168,6 +186,8 @@ func Test_storeUnresolvedBatchKeys(t *testing.T) {
}

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

testError := errors.New("test error")
testData := []types.BatchKey{
{
Expand Down Expand Up @@ -209,7 +229,11 @@ func Test_getUnresolvedBatchKeys(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
t.Parallel()

testDB := tt.db(t)

if keys, err := getUnresolvedBatchKeys(context.Background(), testDB); tt.wantErr {
Expand All @@ -223,6 +247,8 @@ func Test_getUnresolvedBatchKeys(t *testing.T) {
}

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

testError := errors.New("test error")
testData := []types.BatchKey{
{
Expand Down Expand Up @@ -263,7 +289,11 @@ func Test_deleteUnresolvedBatchKeys(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
t.Parallel()

testDB := tt.db(t)

if err := deleteUnresolvedBatchKeys(context.Background(), testDB, testData); tt.wantErr {
Expand All @@ -276,6 +306,8 @@ func Test_deleteUnresolvedBatchKeys(t *testing.T) {
}

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

testError := errors.New("test error")
testData := []types.OffChainData{
{
Expand Down Expand Up @@ -317,7 +349,11 @@ func Test_storeOffchainData(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
t.Parallel()

testDB := tt.db(t)

if err := storeOffchainData(context.Background(), testDB, tt.data); tt.wantErr {
Expand All @@ -330,6 +366,8 @@ func Test_storeOffchainData(t *testing.T) {
}

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

testError := errors.New("test error")

tests := []struct {
Expand All @@ -341,6 +379,8 @@ func Test_detectOffchainDataGaps(t *testing.T) {
{
name: "DetectOffchainDataGaps returns error",
db: func(t *testing.T) db.DB {
t.Helper()

mockDB := mocks.NewDB(t)

mockDB.On("DetectOffchainDataGaps", mock.Anything).Return(nil, testError)
Expand All @@ -353,6 +393,8 @@ func Test_detectOffchainDataGaps(t *testing.T) {
{
name: "all good",
db: func(t *testing.T) db.DB {
t.Helper()

mockDB := mocks.NewDB(t)

mockDB.On("DetectOffchainDataGaps", mock.Anything).Return(map[uint64]uint64{1: 3}, nil)
Expand All @@ -364,7 +406,11 @@ func Test_detectOffchainDataGaps(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
t.Parallel()

testDB := tt.db(t)

if gaps, err := detectOffchainDataGaps(context.Background(), testDB); tt.wantErr {
Expand Down

0 comments on commit a44c5e1

Please sign in to comment.