about summary refs log tree commit diff
path: root/src/payload-processor/processor/processor_test.go
blob: 5fa34a8f9bae8dbe25e248f440ae953e5cf497ea (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
27
28
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")

	ctx := context.Background()

	mockdb.EXPECT().TestInsert(ctx, string(message)).Return(nil)

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

	require.NoError(t, err)
}