Skip to content

Commit

Permalink
Add spec to orders_fetcher test suite to asser that TOO can see a mov…
Browse files Browse the repository at this point in the history
…e with only a PPM shipment
  • Loading branch information
hannaliebl committed Apr 26, 2022
1 parent 2ee3396 commit 125911c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions pkg/services/order/order_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,3 +570,30 @@ func (suite *OrderServiceSuite) TestListOrdersForTOOWithNTSRelease() {
suite.Equal(1, moveCount)
suite.Len(moves, 1)
}

func (suite *OrderServiceSuite) TestListOrdersForTOOWithPPM() {
postalCode := "90210"
move := testdatagen.MakeMove(suite.DB(), testdatagen.Assertions{
Move: models.Move{
Status: models.MoveStatusAPPROVED,
},
})
ppmShipment := testdatagen.MakePPMShipment(suite.DB(), testdatagen.Assertions{
Move: move,
PPMShipment: models.PPMShipment{
PickupPostalCode: postalCode,
},
})

// Make a TOO user and the postal code to GBLOC link.
tooOfficeUser := testdatagen.MakeTOOOfficeUser(suite.DB(), testdatagen.Assertions{})
// GBLOC for the below doesn't really matter, it just means the query for the moves passes the inner join in ListOrders
testdatagen.MakePostalCodeToGBLOC(suite.DB(), move.Orders.OriginDutyLocation.Address.PostalCode, "FOO")
testdatagen.MakePostalCodeToGBLOC(suite.DB(), ppmShipment.PickupPostalCode, tooOfficeUser.TransportationOffice.Gbloc)

orderFetcher := NewOrderFetcher()
moves, moveCount, err := orderFetcher.ListOrders(suite.AppContextForTest(), tooOfficeUser.ID, &services.ListOrderParams{})
suite.FatalNoError(err)
suite.Equal(1, moveCount)
suite.Len(moves, 1)
}

0 comments on commit 125911c

Please sign in to comment.