Skip to content

Commit

Permalink
Merge pull request #14799 from transcom/MAIN-B-21939
Browse files Browse the repository at this point in the history
MAIN B-21939
  • Loading branch information
cameroncaci authored Feb 13, 2025
2 parents 4bbf4d2 + def7cad commit 3274d40
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/pages/PrimeUI/MoveTaskOrder/MoveDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import scrollToTop from 'shared/scrollToTop';
import { SERVICE_ITEMS_ALLOWED_UPDATE } from 'constants/serviceItems';
import { MoveOrderDocumentType } from 'shared/constants';
import { CHECK_SPECIAL_ORDERS_TYPES, SPECIAL_ORDERS_TYPES } from 'constants/orders';
import { formatWeight } from 'utils/formatters';

const MoveDetails = ({ setFlashMessage }) => {
const { moveCodeOrID } = useParams();
Expand Down Expand Up @@ -207,6 +208,14 @@ const MoveDetails = ({ setFlashMessage }) => {
<dt>Gun Safe:</dt>
<dd>{moveTaskOrder.order.entitlement.gunSafe ? 'yes' : 'no'}</dd>
</div>
<div className={descriptionListStyles.row}>
<dt>Admin Restricted Weight:</dt>
<dd>
{moveTaskOrder.order.entitlement.weightRestriction > 0
? formatWeight(moveTaskOrder.order.entitlement.weightRestriction)
: 'no'}
</dd>
</div>
<div className={descriptionListStyles.row}>
<Button onClick={handleDownloadOrders}>Download Move Orders</Button>
<select
Expand Down
21 changes: 21 additions & 0 deletions src/pages/PrimeUI/MoveTaskOrder/MoveDetails.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { usePrimeSimulatorGetMove } from 'hooks/queries';
import { MockProviders } from 'testUtils';
import { completeCounseling, deleteShipment, downloadMoveOrder } from 'services/primeApi';
import { primeSimulatorRoutes } from 'constants/routes';
import { formatWeight } from 'utils/formatters';

const mockRequestedMoveCode = 'LN4T89';

Expand Down Expand Up @@ -194,6 +195,7 @@ const moveTaskOrder = {
order: {
entitlement: {
gunSafe: true,
weightRestriction: 500,
},
},
};
Expand Down Expand Up @@ -224,6 +226,25 @@ const renderWithProviders = (component) => {
};
describe('PrimeUI MoveDetails page', () => {
describe('check move details page load', () => {
it('renders move and entitlement detais on load', async () => {
usePrimeSimulatorGetMove.mockReturnValue(moveReturnValue);

renderWithProviders(<MoveDetails />);

await waitFor(() => {
expect(screen.getByText(/Move Code/)).toBeInTheDocument();
expect(screen.getByText(/Move Id/)).toBeInTheDocument();
const gunSafe = screen.getByText('Gun Safe:');
expect(gunSafe).toBeInTheDocument();
expect(gunSafe.nextElementSibling.textContent).toBe('yes');
const adminRestrictedWeight = screen.getByText('Admin Restricted Weight:');
expect(adminRestrictedWeight).toBeInTheDocument();
expect(adminRestrictedWeight.nextElementSibling.textContent).toBe(
formatWeight(moveTaskOrder.order.entitlement.weightRestriction),
);
});
});

it('displays payment requests information', async () => {
usePrimeSimulatorGetMove.mockReturnValue(moveReturnValue);
renderWithProviders(<MoveDetails />);
Expand Down

0 comments on commit 3274d40

Please sign in to comment.