Skip to content

Commit

Permalink
adding some more tests for SIT costs and breakdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljordan-caci committed Jan 21, 2025
1 parent 30cf31e commit d555773
Showing 1 changed file with 104 additions and 0 deletions.
104 changes: 104 additions & 0 deletions pkg/services/ppmshipment/ppm_estimator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2542,5 +2542,109 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() {
suite.NotNil(estimatedSITCost)
suite.Equal(unit.Cents(41080), *estimatedSITCost)
})

suite.Run("CalculatePPMSITEstimatedCost - Success for OCONUS PPM", func() {
originLocation := models.SITLocationTypeDestination
entryDate := time.Date(2020, time.March, 15, 0, 0, 0, 0, time.UTC)
ppm := factory.BuildPPMShipment(suite.DB(), []factory.Customization{
{
Model: models.PPMShipment{
EstimatedWeight: models.PoundPointer(4000),
SITExpected: models.BoolPointer(true),
SITLocation: &originLocation,
SITEstimatedWeight: models.PoundPointer(unit.Pound(2000)),
SITEstimatedEntryDate: &entryDate,
SITEstimatedDepartureDate: models.TimePointer(entryDate.Add(time.Hour * 24 * 30)),
},
},
{
Model: models.MTOShipment{
MarketCode: models.MarketCodeInternational,
},
},
{
Model: models.Address{
StreetAddress1: "Tester Address",
City: "Tulsa",
State: "OK",
PostalCode: "74133",
},
Type: &factory.Addresses.PickupAddress,
},
{
Model: models.Address{
StreetAddress1: "JBER",
City: "JBER",
State: "AK",
PostalCode: "99505",
IsOconus: models.BoolPointer(true),
},
Type: &factory.Addresses.DeliveryAddress,
},
}, nil)

newPPM := ppm
newEstimatedWeight := models.PoundPointer(5500)
newPPM.SITEstimatedWeight = newEstimatedWeight
setupPricerData()

estimatedSITCost, err := ppmEstimator.CalculatePPMSITEstimatedCost(suite.AppContextForTest(), &ppm)
suite.NilOrNoVerrs(err)
suite.NotNil(estimatedSITCost)
suite.Equal(unit.Cents(20540), *estimatedSITCost)
})

suite.Run("CalculatePPMSITEstimatedCostBreakdown - Success for OCONUS PPM", func() {
originLocation := models.SITLocationTypeDestination
entryDate := time.Date(2020, time.March, 15, 0, 0, 0, 0, time.UTC)
ppm := factory.BuildPPMShipment(suite.DB(), []factory.Customization{
{
Model: models.PPMShipment{
EstimatedWeight: models.PoundPointer(4000),
SITExpected: models.BoolPointer(true),
SITLocation: &originLocation,
SITEstimatedWeight: models.PoundPointer(unit.Pound(2000)),
SITEstimatedEntryDate: &entryDate,
SITEstimatedDepartureDate: models.TimePointer(entryDate.Add(time.Hour * 24 * 30)),
},
},
{
Model: models.MTOShipment{
MarketCode: models.MarketCodeInternational,
},
},
{
Model: models.Address{
StreetAddress1: "Tester Address",
City: "Tulsa",
State: "OK",
PostalCode: "74133",
},
Type: &factory.Addresses.PickupAddress,
},
{
Model: models.Address{
StreetAddress1: "JBER",
City: "JBER",
State: "AK",
PostalCode: "99505",
IsOconus: models.BoolPointer(true),
},
Type: &factory.Addresses.DeliveryAddress,
},
}, nil)

newPPM := ppm
newEstimatedWeight := models.PoundPointer(5500)
newPPM.SITEstimatedWeight = newEstimatedWeight
setupPricerData()

sitCosts, err := ppmEstimator.CalculatePPMSITEstimatedCostBreakdown(suite.AppContextForTest(), &ppm)
suite.NilOrNoVerrs(err)
suite.NotNil(sitCosts)
suite.Equal(unit.Cents(20540), *sitCosts.EstimatedSITCost)
suite.Equal(unit.Cents(12140), *sitCosts.PriceFirstDaySIT)
suite.Equal(unit.Cents(8400), *sitCosts.PriceAdditionalDaySIT)
})
})
}

0 comments on commit d555773

Please sign in to comment.