package queue_test import ( "context" "queryorchestration/internal/server/queue" queuemock "queryorchestration/mocks/queue" "testing" "github.com/aws/aws-sdk-go-v2/service/sqs" "github.com/aws/aws-sdk-go-v2/service/sqs/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) func TestSend(t *testing.T) { ctx := context.Background() mockSQS := queuemock.NewMockSQSClient(t) cfg := &queue.Config{ URL: "/i/am/here", Client: mockSQS, } mockSQS.EXPECT(). SendMessage( mock.Anything, mock.MatchedBy(func(in *sqs.SendMessageInput) bool { return *in.QueueUrl == cfg.URL && *in.MessageBody == "{}" }), mock.Anything, ). Return(&sqs.SendMessageOutput{}, nil) body := struct{}{} attrs := map[string]types.MessageAttributeValue{} err := queue.Send(ctx, cfg, body, attrs) assert.NoError(t, err) }