Skip to content

Commit

Permalink
Merge pull request #13579 from transcom/B-19191-Email-Template-not-lo…
Browse files Browse the repository at this point in the history
…cating-all-duty-location-names

B-19191: Email Template not locating all duty location names
  • Loading branch information
WeatherfordAaron authored Aug 29, 2024
2 parents 2ff0ce2 + ad42858 commit 03e159d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/notifications/move_submitted.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ func (m MoveSubmitted) emails(appCtx appcontext.AppContext) ([]emailContent, err
if originDSTransportInfo != nil {
originDutyLocationName = &originDSTransportInfo.Name
originDutyLocationPhoneLine = &originDSTransportInfo.PhoneLine

} else if originDutyLocation != nil {
originDutyLocationName = &originDutyLocation.Name
}

totalEntitlement := models.GetWeightAllotment(*orders.Grade)
Expand Down
24 changes: 24 additions & 0 deletions pkg/notifications/move_submitted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@ func (suite *NotificationSuite) TestMoveSubmitted() {
suite.NotEmpty(email.textBody)
}

func (suite *NotificationSuite) TestMoveSubmittedoriginDSTransportInfoIsNil() {
move := factory.BuildMove(suite.DB(), nil, nil)
notification := NewMoveSubmitted(move.ID)

move.Orders.OriginDutyLocationID = nil

emails, err := notification.emails(suite.AppContextWithSessionForTest(&auth.Session{
ServiceMemberID: move.Orders.ServiceMember.ID,
ApplicationName: auth.MilApp,
}))
subject := "Thank you for submitting your move details"

suite.NoError(err)
suite.Equal(len(emails), 1)

email := emails[0]
sm := move.Orders.ServiceMember
suite.Equal(email.recipientEmail, *sm.PersonalEmail)
suite.Equal(email.subject, subject)
suite.NotEmpty(email.htmlBody)
suite.NotEmpty(email.textBody)
suite.Contains(email.textBody, move.Orders.OriginDutyLocation.Name)
}

func (suite *NotificationSuite) TestMoveSubmittedHTMLTemplateRenderWithGovCounseling() {
approver := factory.BuildUser(nil, nil, nil)
move := factory.BuildMove(suite.DB(), nil, nil)
Expand Down

0 comments on commit 03e159d

Please sign in to comment.