Skip to content

Commit

Permalink
va edit (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Medzoner authored Nov 18, 2024
1 parent 0c95c0e commit 89fc77e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/infra/notification/mailer_smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (m *MailerSMTP) Send(ctx context.Context, view entity.Contact) (bool, error
return true, nil
}

// message is a function that returns a message
func (m *MailerSMTP) message(view entity.Contact) []byte {
r, _ := rand.Read(nil)
messageID := strconv.FormatInt(int64(r), 10) + "@" + m.Host
Expand Down
2 changes: 2 additions & 0 deletions pkg/infra/notification/mailer_smtp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ func TestSmtp(t *testing.T) {
httpTracerMock.EXPECT().Error(gomock.Any(), gomock.Any()).Return(nil).Times(1)
mailer := notification.MailerSMTP{RootPath: "./../../..", Tracer: httpTracerMock}
ctx := context.WithValue(context.Background(), middleware.CorrelationContextKey{}, uuid.New().String())

_, _ = mailer.Send(ctx, entity.Contact{})
})
t.Run("Unit: test Smtp failed with bad RootPath", func(t *testing.T) {
httpTracerMock := tracerMock.NewMockTracer(gomock.NewController(t))
httpTracerMock.EXPECT().Start(gomock.Any(), gomock.Any(), gomock.Any()).Return(context.Background(), noop.Span{}).Times(1)
mailer := notification.MailerSMTP{RootPath: "", Tracer: httpTracerMock}

_, _ = mailer.Send(context.Background(), entity.Contact{})
})
}

0 comments on commit 89fc77e

Please sign in to comment.