From 7bf54af3134ed57a11fbb8eba0a459d9d597aa9e Mon Sep 17 00:00:00 2001 From: jquispe-oddball Date: Fri, 27 Dec 2024 10:56:04 -0500 Subject: [PATCH] 96894 - cypress and linter error fix --- .../containers/POARequestsPage.jsx | 4 -- .../components/POARequestsCard.unit.spec.jsx | 65 +++++-------------- 2 files changed, 17 insertions(+), 52 deletions(-) diff --git a/src/applications/accredited-representative-portal/containers/POARequestsPage.jsx b/src/applications/accredited-representative-portal/containers/POARequestsPage.jsx index df2c21d5f554..45722347c129 100644 --- a/src/applications/accredited-representative-portal/containers/POARequestsPage.jsx +++ b/src/applications/accredited-representative-portal/containers/POARequestsPage.jsx @@ -28,8 +28,6 @@ const POARequestsPage = () => { : 'poa-request__tab-link' } role="tab" - aria-controls="panel-pending" - id="pending" > Pending requests @@ -41,8 +39,6 @@ const POARequestsPage = () => { : 'poa-request__tab-link' } role="tab" - aria-controls="panel-completed" - id="completed" > Completed requests diff --git a/src/applications/accredited-representative-portal/tests/unit/components/POARequestsCard.unit.spec.jsx b/src/applications/accredited-representative-portal/tests/unit/components/POARequestsCard.unit.spec.jsx index 3cfb468a1487..d757a27c6da6 100644 --- a/src/applications/accredited-representative-portal/tests/unit/components/POARequestsCard.unit.spec.jsx +++ b/src/applications/accredited-representative-portal/tests/unit/components/POARequestsCard.unit.spec.jsx @@ -1,56 +1,25 @@ import { expect } from 'chai'; -import upperFirst from 'lodash/upperFirst'; import React from 'react'; -import { formatDateParsedZoneLong } from 'platform/utilities/date/index'; -import POARequestsCard from '../../../components/POARequestsCard/POARequestsCard'; +import { render } from '@testing-library/react'; +import { createMemoryRouter, RouterProvider } from 'react-router-dom'; +import POARequestsPage from '../../../components/POARequestsCard/POARequestsCard'; +// import { poaRequestsLoader } from '../../../containers/POARequestsPage'; import mockPOARequestsResponse from '../../../mocks/mockPOARequestsResponse.json'; -import { renderTestApp } from '../helpers'; - -const MOCK_POA_REQUESTS = mockPOARequestsResponse.data; +import ErrorMessage from '../../../components/common/ErrorMessage'; describe('POARequestsTable', () => { - it('renders card', () => { - const { getByTestId } = renderTestApp( - , - ); - expect(getByTestId('poa-requests-card')).to.exist; - }); - - it('renders POA requests', () => { - const { getByTestId } = renderTestApp( - , - ); - - MOCK_POA_REQUESTS.forEach(({ id, attributes }) => { - expect(getByTestId(`poa-request-card-${id}-status`).textContent).to.eq( - upperFirst(attributes.status), - ); - expect(getByTestId(`poa-request-card-${id}-name`).textContent).to.eq( - `${attributes.claimant.lastName}, ${attributes.claimant.firstName}`, - ); + it('loads error component on POA requests page', async () => { + const routes = [ + { + path: '/representative/poa-requests', + element: , + loader: mockPOARequestsResponse, + errorElement: , + }, + ]; + const router = createMemoryRouter(routes); - expect(getByTestId(`poa-request-card-${id}-city`).textContent).to.eq( - attributes.claimantAddress.city, - ); - expect(getByTestId(`poa-request-card-${id}-state`).textContent).to.eq( - attributes.claimantAddress.state, - ); - expect(getByTestId(`poa-request-card-${id}-zip`).textContent).to.eq( - attributes.claimantAddress.zip, - ); - if (attributes.status === 'Declined') { - expect( - getByTestId(`poa-request-card-${id}-declined`).textContent, - ).to.eq(formatDateParsedZoneLong(attributes.acceptedOrDeclinedAt)); - } else if (attributes.status === 'Accepted') { - expect( - getByTestId(`poa-request-card-${id}-accepted`).textContent, - ).to.eq(formatDateParsedZoneLong(attributes.acceptedOrDeclinedAt)); - } else { - expect( - getByTestId(`poa-request-card-${id}-received`).textContent, - ).to.eq(formatDateParsedZoneLong(attributes.expiresAt)); - } - }); + const { getByTestId } = await render(); + await expect(getByTestId('error-message')).to.exist; }); });