Files
query-orchestration/internal/server/queue/send_test.go
T
Michael McGuinness 7001ca854c Merged in feature/docinitialisation (pull request #41)
Queuing Changes and Cfg Testing

* staarting

* staarting

* startedpush

* note

* save

* mocking

* removederrs

* fixtests

* cleanuperrs

* newenvsetup

* preppingtests

* queue

* mmovetocfgpassunittests

* sortoutconfig

* passinginteg

* deps

* fixtests
2025-02-03 17:30:50 +00:00

39 lines
863 B
Go

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)
}