Skip to content

Commit

Permalink
fixed tests for createMTOShipment, patchMTOShipment to be updated wit…
Browse files Browse the repository at this point in the history
…h 18434
  • Loading branch information
r-mettler committed Jan 30, 2024
1 parent 6470d7d commit 813b5f6
Show file tree
Hide file tree
Showing 3 changed files with 456 additions and 360 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ const validationShape = {
.required('Required'),
};

// const addressValidator = {
// streetAddress1: Yup.string().required('Required'),
// streetAddress2: Yup.string(),
// streetAddress3: Yup.string(),
// city: Yup.string().required('Required'),
// state: Yup.string().length(2, 'Must use state abbreviation').required('Required'),
// postalCode: Yup.string().matches(ZIP5_CODE_REGEX, 'Must be valid zip code').required('Required'),
// };

const DateAndLocationForm = ({ mtoShipment, destinationDutyLocation, serviceMember, move, onBack, onSubmit }) => {
const initialValues = {
pickupPostalCode: mtoShipment?.ppmShipment?.pickupPostalCode || '',
Expand Down Expand Up @@ -170,7 +161,7 @@ const DateAndLocationForm = ({ mtoShipment, destinationDutyLocation, serviceMemb
/>
</Fieldset>
</FormGroup>
{values.hasSecondaryPickup === 'true' && (
{values.hasSecondaryPickupAddress === 'true' && (
<>
<AddressFields name="secondaryPickupAddress.address" />
<Hint className={ppmStyles.hint}>
Expand Down Expand Up @@ -228,7 +219,7 @@ const DateAndLocationForm = ({ mtoShipment, destinationDutyLocation, serviceMemb
/>
</Fieldset>
</FormGroup>
{values.hasSecondaryDestinationPostalCode === 'true' && (
{values.hasSecondaryDestinationAddress === 'true' && (
<>
<AddressFields name="secondaryDestinationAddress.address" />
<Hint className={ppmStyles.hint}>
Expand Down
14 changes: 6 additions & 8 deletions src/pages/MyMove/PPM/Booking/DateAndLocation/DateAndLocation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,19 @@ const DateAndLocation = ({ mtoShipment, serviceMember, destinationDutyLocation,
const handleSubmit = async (values, { setSubmitting }) => {
setErrorMessage(null);

const hasSecondaryPickupPostalCode = values.hasSecondaryPickupPostalCode === 'true';
const hasSecondaryDestinationPostalCode = values.hasSecondaryDestinationPostalCode === 'true';
const hasSecondaryPickupAddress = values.hasSecondaryPickupAddress === 'true';
const hasSecondaryDestinationAddress = values.hasSecondaryDestinationAddress === 'true';

const createOrUpdateShipment = {
moveTaskOrderID: moveId,
shipmentType: SHIPMENT_OPTIONS.PPM,
ppmShipment: {
pickupPostalCode: values.pickupAddress.address.postalCode,
hasSecondaryPickupPostalCode, // I think sending this is necessary so we know if the customer wants to clear their previously secondary ZIPs, or we could send nulls for those fields.
secondaryPickupPostalCode: hasSecondaryPickupPostalCode
? values.secondaryPickupAddress.address.postalCode
: null,
hasSecondaryPickupAddress, // I think sending this is necessary so we know if the customer wants to clear their previously secondary ZIPs, or we could send nulls for those fields.
secondaryPickupPostalCode: hasSecondaryPickupAddress ? values.secondaryPickupAddress.address.postalCode : null,
destinationPostalCode: values.destinationAddress.address.postalCode,
hasSecondaryDestinationPostalCode,
secondaryDestinationPostalCode: hasSecondaryDestinationPostalCode
hasSecondaryDestinationAddress,
secondaryDestinationPostalCode: hasSecondaryDestinationAddress
? values.secondaryDestinationAddress.address.postalCode
: null,
sitExpected: values.sitExpected === 'true',
Expand Down
Loading

0 comments on commit 813b5f6

Please sign in to comment.