about summary refs log tree commit diff
path: root/src/payload-processor/processor/processor_test.go
blob: 5e954c48a1c1fe2d86337e7683ef271352b7dbec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package processor

import (
	"context"
	"testing"

	"github.com/segmentio/kafka-go"
	"github.com/stretchr/testify/require"
	gomock "go.uber.org/mock/gomock"
)

func TestProcessMessage(t *testing.T) {
	ctrl := gomock.NewController(t)
	mockdb := NewMockDB(ctrl)
	processor := Processor{
		db: mockdb,
	}

	message := []byte("test")

	mockdb.EXPECT().TestInsert(gomock.Any(), string(message)).Return(nil)

	err := processor.handleMessage(context.Background(), kafka.Message{Value: message})

	require.NoError(t, err)
}