Skip to content

Commit 9ba6fde

Browse files
committed
fix golangci-lint
1 parent b1c2688 commit 9ba6fde

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

block/batch_queue_test.go

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package block
33
import (
44
"testing"
55

6+
"github.com/stretchr/testify/require"
7+
68
"github.com/rollkit/go-sequencing"
7-
"github.com/stretchr/testify/assert"
89
)
910

1011
// MockBatch is a mock implementation of sequencing.Batch for testing purposes
@@ -24,8 +25,8 @@ var (
2425
func TestNewBatchQueue(t *testing.T) {
2526
// Test creating a new BatchQueue
2627
bq := NewBatchQueue()
27-
assert.NotNil(t, bq, "NewBatchQueue should return a non-nil instance")
28-
assert.Empty(t, bq.queue, "New BatchQueue should have an empty queue")
28+
require.NotNil(t, bq, "NewBatchQueue should return a non-nil instance")
29+
require.Empty(t, bq.queue, "New BatchQueue should have an empty queue")
2930
}
3031

3132
func TestBatchQueue_AddBatch(t *testing.T) {
@@ -34,35 +35,35 @@ func TestBatchQueue_AddBatch(t *testing.T) {
3435

3536
// Add the first batch and check
3637
bq.AddBatch(batch1)
37-
assert.Len(t, bq.queue, 1, "BatchQueue should have 1 batch after adding")
38-
assert.Equal(t, batch1, bq.queue[0], "The first batch should match the one added")
38+
require.Len(t, bq.queue, 1, "BatchQueue should have 1 batch after adding")
39+
require.Equal(t, batch1, bq.queue[0], "The first batch should match the one added")
3940

4041
// Add the second batch and check
4142
bq.AddBatch(batch2)
42-
assert.Len(t, bq.queue, 2, "BatchQueue should have 2 batches after adding another")
43-
assert.Equal(t, batch2, bq.queue[1], "The second batch should match the one added")
43+
require.Len(t, bq.queue, 2, "BatchQueue should have 2 batches after adding another")
44+
require.Equal(t, batch2, bq.queue[1], "The second batch should match the one added")
4445
}
4546

4647
func TestBatchQueue_Next(t *testing.T) {
4748
// Create a new BatchQueue
4849
bq := NewBatchQueue()
4950

5051
// Test with empty queue
51-
assert.Nil(t, bq.Next(), "Next should return nil when the queue is empty")
52+
require.Nil(t, bq.Next(), "Next should return nil when the queue is empty")
5253

5354
// Add batches
5455
bq.AddBatch(batch1)
5556
bq.AddBatch(batch2)
5657

5758
// Retrieve the first batch
5859
nextBatch := bq.Next()
59-
assert.NotNil(t, nextBatch, "Next should return the first batch when called")
60-
assert.Equal(t, batch1, *nextBatch, "Next should return the first batch added")
61-
assert.Len(t, bq.queue, 1, "BatchQueue should have 1 batch after retrieving the first")
60+
require.NotNil(t, nextBatch, "Next should return the first batch when called")
61+
require.Equal(t, batch1, *nextBatch, "Next should return the first batch added")
62+
require.Len(t, bq.queue, 1, "BatchQueue should have 1 batch after retrieving the first")
6263

6364
// Retrieve the second batch
6465
nextBatch = bq.Next()
65-
assert.NotNil(t, nextBatch, "Next should return the second batch when called")
66-
assert.Equal(t, batch2, *nextBatch, "Next should return the second batch added")
67-
assert.Empty(t, bq.queue, "BatchQueue should be empty after retrieving all batches")
66+
require.NotNil(t, nextBatch, "Next should return the second batch when called")
67+
require.Equal(t, batch2, *nextBatch, "Next should return the second batch added")
68+
require.Empty(t, bq.queue, "BatchQueue should be empty after retrieving all batches")
6869
}

0 commit comments

Comments
 (0)