Skip to content

Commit

Permalink
Merge pull request #13935 from transcom/B-20977-USMC-Moves-Search
Browse files Browse the repository at this point in the history
B 20977 usmc moves search
  • Loading branch information
WeatherfordAaron authored Oct 21, 2024
2 parents 67c284b + 16ffcfd commit 51f5619
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/handlers/ghcapi/internal/payloads/model_to_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -2294,6 +2294,8 @@ func SearchMoves(appCtx appcontext.AppContext, moves models.Moves) *ghcmessages.

if err != nil {
destinationGBLOC = *ghcmessages.NewGBLOC("")
} else if customer.Affiliation.String() == "MARINES" {
destinationGBLOC = ghcmessages.GBLOC("USMC/" + PostalCodeToGBLOC.GBLOC)
} else {
destinationGBLOC = ghcmessages.GBLOC(PostalCodeToGBLOC.GBLOC)
}
Expand Down
22 changes: 22 additions & 0 deletions pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/gofrs/uuid"

"github.com/transcom/mymove/pkg/factory"
"github.com/transcom/mymove/pkg/gen/ghcmessages"
"github.com/transcom/mymove/pkg/handlers"
"github.com/transcom/mymove/pkg/models"
Expand Down Expand Up @@ -350,3 +351,24 @@ func (suite *PayloadsSuite) TestCreateCustomer() {
suite.IsType(returnedShipmentAddressUpdate, &ghcmessages.CreatedCustomer{})
})
}

func (suite *PayloadsSuite) TestSearchMoves() {
appCtx := suite.AppContextForTest()

marines := models.AffiliationMARINES
moveUSMC := factory.BuildMove(suite.DB(), []factory.Customization{
{
Model: models.ServiceMember{
Affiliation: &marines,
},
},
}, nil)

moves := models.Moves{moveUSMC}
suite.Run("Success - Returns a ghcmessages Upload payload from Upload Struct", func() {
payload := SearchMoves(appCtx, moves)

suite.IsType(payload, &ghcmessages.SearchMoves{})
suite.NotNil(payload)
})
}

0 comments on commit 51f5619

Please sign in to comment.