Skip to content

Commit

Permalink
Merge pull request #13677 from transcom/B-19810-INT
Browse files Browse the repository at this point in the history
B-19810 INT
  • Loading branch information
traskowskycaci authored Sep 13, 2024
2 parents 0937990 + a0bdfae commit ff64926
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/pages/Office/MovePaymentRequests/MovePaymentRequests.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ const MovePaymentRequests = ({
setUnapprovedServiceItemCount(serviceItemCount);
}, [mtoShipments, setUnapprovedServiceItemCount]);

const pendingCount = paymentRequests?.filter((pr) => pr.status === paymentRequestStatus.PENDING).length;
useEffect(() => {
const pendingCount = paymentRequests?.filter((pr) => pr.status === paymentRequestStatus.PENDING).length;
setPendingPaymentRequestCount(pendingCount);
}, [paymentRequests, setPendingPaymentRequestCount]);
}, [pendingCount, setPendingPaymentRequestCount]);

const excludePPMShipments = mtoShipments?.filter((shipment) => shipment.shipmentType !== 'PPM');

Expand Down Expand Up @@ -221,11 +221,12 @@ const MovePaymentRequests = ({
<div className={txoStyles.container} data-testid="MovePaymentRequests">
<LeftNav sections={sections}>
<LeftNavTag
background="#e34b11"
associatedSectionName="payment-requests"
showTag={paymentRequests?.length > 0}
testID="numOfPaymentRequestsTag"
showTag={pendingCount > 0}
testID="numOfPendingPaymentRequestsTag"
>
{paymentRequests.length}
{pendingCount}
</LeftNavTag>
<LeftNavTag
className={classnames('usa-tag usa-tag--alert', styles.errorTag)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}

.warning {
color: $warning;
color: $error;

&.errorTag {
width: 20px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,10 @@ describe('MovePaymentRequests', () => {
});
});

it('displays the number of payment request on leftnav sidebar', async () => {
it('displays the number of pending payment requests on leftnav sidebar', async () => {
renderMovePaymentRequests(testProps);
await waitFor(() => {
expect(screen.getByTestId('numOfPaymentRequestsTag').textContent).toEqual('2');
expect(screen.getByTestId('numOfPendingPaymentRequestsTag').textContent).toEqual('1');
});
});
});
Expand All @@ -525,10 +525,10 @@ describe('MovePaymentRequests', () => {
expect(paymentRequstNavLink.text).toContain(name);
});

it('displays the number of payment request on leftnav sidebar', async () => {
it('does not display the number of pending payment requests on leftnav sidebar if no pending exist', async () => {
renderMovePaymentRequests(testProps);
await waitFor(() => {
expect(screen.getByTestId('numOfPaymentRequestsTag').textContent).toEqual('1');
expect(screen.queryByTestId('numOfPendingPaymentRequestsTag')).not.toBeInTheDocument();
});
});
});
Expand Down

0 comments on commit ff64926

Please sign in to comment.