diff --git a/pkg/factory/duty_location_factory.go b/pkg/factory/duty_location_factory.go index 5d884074768..5ad1a099741 100644 --- a/pkg/factory/duty_location_factory.go +++ b/pkg/factory/duty_location_factory.go @@ -1,6 +1,8 @@ package factory import ( + "fmt" + "github.com/gobuffalo/pop/v6" "github.com/transcom/mymove/pkg/gen/internalmessages" @@ -53,7 +55,8 @@ func buildDutyLocationWithBuildType(db *pop.Connection, customs []Customization, affiliation := internalmessages.AffiliationAIRFORCE location := models.DutyLocation{ - Name: MakeRandomString(10), + // Make test duty location name consistent with how TRDM duty location is formatted + Name: fmt.Sprintf("%s, %s %s", MakeRandomString(10), dlAddress.State, dlAddress.PostalCode), Affiliation: &affiliation, AddressID: dlAddress.ID, Address: dlAddress, @@ -128,18 +131,18 @@ func FetchOrBuildCurrentDutyLocation(db *pop.Connection) models.DutyLocation { return BuildDutyLocation(nil, []Customization{ { Model: models.DutyLocation{ - Name: "Yuma AFB", + Name: "Yuma AFB, IA 50309", }, }, }, nil) } // Check if Yuma Duty Location exists, if not, create it. - defaultLocation, err := models.FetchDutyLocationByName(db, "Yuma AFB") + defaultLocation, err := models.FetchDutyLocationByName(db, "Yuma AFB, IA 50309") if err != nil { return BuildDutyLocation(db, []Customization{ { Model: models.DutyLocation{ - Name: "Yuma AFB", + Name: "Yuma AFB, IA 50309", }, }, }, nil) diff --git a/pkg/factory/duty_location_factory_test.go b/pkg/factory/duty_location_factory_test.go index 6a6c4df67c1..2aa10a20200 100644 --- a/pkg/factory/duty_location_factory_test.go +++ b/pkg/factory/duty_location_factory_test.go @@ -17,7 +17,7 @@ func (suite *FactorySuite) TestBuildDutyLocation() { }) suite.Run("test fetch stubbed current duty location", func() { dutyLocation := FetchOrBuildCurrentDutyLocation(nil) - suite.Equal("Yuma AFB", dutyLocation.Name) + suite.Equal("Yuma AFB, IA 50309", dutyLocation.Name) }) suite.Run("test fetch stubbed orders duty location", func() { dutyLocation := FetchOrBuildOrdersDutyLocation(nil) diff --git a/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet.go b/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet.go index 03c9137db1a..80d23a92f89 100644 --- a/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet.go +++ b/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet.go @@ -229,8 +229,9 @@ func FormatValuesShipmentSummaryWorksheetFormPage1(data services.ShipmentSummary page1.OrdersIssueDate = FormatDate(data.Order.IssueDate) page1.OrdersTypeAndOrdersNumber = FormatOrdersTypeAndOrdersNumber(data.Order) - page1.AuthorizedOrigin = FormatLocation(data.CurrentDutyLocation) + page1.AuthorizedOrigin = data.CurrentDutyLocation.Name page1.AuthorizedDestination = data.NewDutyLocation.Name + page1.NewDutyAssignment = data.NewDutyLocation.Name page1.WeightAllotment = FormatWeights(data.WeightAllotment.Entitlement) @@ -447,11 +448,6 @@ func formatSSWDate(signedCertifications []*models.SignedCertification, ppmid uui return "", errors.New("Payment Packet is not certified") } -// FormatLocation formats AuthorizedOrigin and AuthorizedDestination for Shipment Summary Worksheet -func FormatLocation(dutyLocation models.DutyLocation) string { - return fmt.Sprintf("%s, %s %s", dutyLocation.Name, dutyLocation.Address.State, dutyLocation.Address.PostalCode) -} - // FormatAddress retrieves a PPMShipment W2Address and formats it for the SSW Document func FormatAddress(w2Address *models.Address) string { var addressString string diff --git a/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet_test.go b/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet_test.go index 92cb2fc865a..c163d99eef0 100644 --- a/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet_test.go +++ b/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet_test.go @@ -554,14 +554,6 @@ func (suite *ShipmentSummaryWorksheetServiceSuite) TestFormatSSWGetEntitlementNo suite.Equal(unit.Pound(500), sswEntitlement.SpouseProGear) } -func (suite *ShipmentSummaryWorksheetServiceSuite) TestFormatLocation() { - fortEisenhower := models.DutyLocation{Name: "Fort Eisenhower, GA 30813", Address: models.Address{State: "GA", PostalCode: "30813"}} - yuma := models.DutyLocation{Name: "Yuma AFB", Address: models.Address{State: "IA", PostalCode: "50309"}} - - suite.Equal("Fort Eisenhower, GA 30813", fortEisenhower.Name) - suite.Equal("Yuma AFB, IA 50309", FormatLocation(yuma)) -} - func (suite *ShipmentSummaryWorksheetServiceSuite) TestFormatServiceMemberFullName() { sm1 := models.ServiceMember{ Suffix: models.StringPointer("Jr."),