Skip to content

Commit

Permalink
Merge pull request #35 from inaciogu/fix/set-logger
Browse files Browse the repository at this point in the history
fix: test set logger method
  • Loading branch information
inaciogu committed Jan 23, 2024
2 parents 4dc212b + 7816bc9 commit d7337da
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions consumer/sqsclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ import (
"github.com/stretchr/testify/suite"
)

type MockLogger struct {
mock.Mock
}

func (m *MockLogger) Log(message string, v ...interface{}) {
m.Called(message, v)
}

type UnitTest struct {
suite.Suite
mockSQSService *mocks.SQSService
Expand Down Expand Up @@ -51,6 +59,18 @@ func (ut *UnitTest) TestNewWithoutQueueName() {
})
}

func (ut *UnitTest) TestSetLogger() {
logger := new(MockLogger)

client := client.New(nil, client.SQSClientOptions{
QueueName: "fake-queue-name",
})

client.SetLogger(logger)

assert.NotNil(ut.T(), client)
}

func (ut *UnitTest) TestGetQueueUrl() {
expectedOutput := &sqs.GetQueueUrlOutput{
QueueUrl: aws.String("https://fake-queue-url"),
Expand Down

0 comments on commit d7337da

Please sign in to comment.