Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B 20977 usmc moves search #13935

Merged
merged 8 commits into from
Oct 21, 2024
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)
})
}