Skip to content

Commit 5479c64

Browse files
committed
chore: refactor test code
1 parent da48b69 commit 5479c64

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

kq/pusher_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ import (
1111
"github.com/stretchr/testify/mock"
1212
)
1313

14-
// MockKafkaWriter is a mock for kafka.Writer
15-
type MockKafkaWriter struct {
14+
// mockKafkaWriter is a mock for kafka.Writer
15+
type mockKafkaWriter struct {
1616
mock.Mock
1717
}
1818

19-
func (m *MockKafkaWriter) WriteMessages(ctx context.Context, msgs ...kafka.Message) error {
19+
func (m *mockKafkaWriter) WriteMessages(ctx context.Context, msgs ...kafka.Message) error {
2020
args := m.Called(ctx, msgs)
2121
return args.Error(0)
2222
}
2323

24-
func (m *MockKafkaWriter) Close() error {
24+
func (m *mockKafkaWriter) Close() error {
2525
args := m.Called()
2626
return args.Error(0)
2727
}
@@ -66,7 +66,7 @@ func TestNewPusher(t *testing.T) {
6666
}
6767

6868
func TestPusher_Close(t *testing.T) {
69-
mockWriter := new(MockKafkaWriter)
69+
mockWriter := new(mockKafkaWriter)
7070
pusher := &Pusher{
7171
producer: mockWriter,
7272
}
@@ -86,7 +86,7 @@ func TestPusher_Name(t *testing.T) {
8686
}
8787

8888
func TestPusher_Push(t *testing.T) {
89-
mockWriter := new(MockKafkaWriter)
89+
mockWriter := new(mockKafkaWriter)
9090
pusher := &Pusher{
9191
producer: mockWriter,
9292
topic: "test-topic",
@@ -103,7 +103,7 @@ func TestPusher_Push(t *testing.T) {
103103
}
104104

105105
func TestPusher_PushWithKey(t *testing.T) {
106-
mockWriter := new(MockKafkaWriter)
106+
mockWriter := new(mockKafkaWriter)
107107
pusher := &Pusher{
108108
producer: mockWriter,
109109
topic: "test-topic",
@@ -121,7 +121,7 @@ func TestPusher_PushWithKey(t *testing.T) {
121121
}
122122

123123
func TestPusher_PushWithKey_Error(t *testing.T) {
124-
mockWriter := new(MockKafkaWriter)
124+
mockWriter := new(mockKafkaWriter)
125125
pusher := &Pusher{
126126
producer: mockWriter,
127127
topic: "test-topic",

0 commit comments

Comments
 (0)