diff --git a/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.test.tsx b/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.test.tsx index dcf7a7d81..ff59d2f34 100644 --- a/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.test.tsx +++ b/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.test.tsx @@ -1,17 +1,19 @@ -import { useContext, useEffect } from 'react'; import { ThemeProvider } from '@emotion/react'; import { render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import TestRouter from '__tests__/util/TestRouter'; import { GqlMockedProvider } from '__tests__/util/graphqlMocking'; import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper'; +import { coordinatesFromContacts } from 'pages/accountLists/[accountListId]/contacts/helpers'; import { ContactsContext, ContactsType, } from 'src/components/Contacts/ContactsContext/ContactsContext'; +import { TableViewModeEnum } from 'src/components/Shared/Header/ListHeader'; import { StatusEnum } from 'src/graphql/types.generated'; import { UserOptionQuery } from 'src/hooks/UserPreference.generated'; import theme from 'src/theme'; +import { ContactRowFragment } from '../ContactRow/ContactRow.generated'; import { ContactsLeftPanel } from './ContactsLeftPanel'; const router = { @@ -47,8 +49,9 @@ const mocks = { status: StatusEnum.PartnerFinancial, primaryAddress: { geo: '10,20', + createdAt: '2021-01-01', }, - }, + } as ContactRowFragment, ], }, }, @@ -60,32 +63,50 @@ const mocks = { }, }; +const mapData = coordinatesFromContacts( + { + nodes: [...mocks.Contacts.contacts.nodes], + pageInfo: { endCursor: 'Mg', hasNextPage: false }, + totalCount: 1, + }, + 'en-US', +); + describe('ContactsLeftPanel', () => { it('pans to the selected contact', async () => { const panTo = jest.fn(); const setZoom = jest.fn(); - const Component = () => { - const { mapRef } = useContext(ContactsContext) as ContactsType; - - useEffect(() => { - mapRef.current = { - panTo, - setZoom, - } as unknown as google.maps.Map; - }, []); - - return null; - }; const { findByText } = render( mocks={mocks}> - <> - + - + diff --git a/src/components/Tool/Appeal/Modals/PledgeModal/PledgeModal.test.tsx b/src/components/Tool/Appeal/Modals/PledgeModal/PledgeModal.test.tsx index 4dbc19987..43e645fca 100644 --- a/src/components/Tool/Appeal/Modals/PledgeModal/PledgeModal.test.tsx +++ b/src/components/Tool/Appeal/Modals/PledgeModal/PledgeModal.test.tsx @@ -410,7 +410,7 @@ describe('PledgeModal', () => { ); }); - it('can not select the status given or received if the pledge does not have one of those statuses already', async () => { + it('can not select the status given if the pledge does not have the status "given"', async () => { const { getByRole, queryByRole } = render( { userEvent.click(getByRole('combobox', { name: 'Status' })); expect(getByRole('option', { name: 'Committed' })).toBeInTheDocument(); - expect(queryByRole('option', { name: 'Received' })).not.toBeInTheDocument(); + expect(getByRole('option', { name: 'Received' })).toBeInTheDocument(); expect(queryByRole('option', { name: 'Given' })).not.toBeInTheDocument(); }); }); diff --git a/src/components/Tool/Appeal/Modals/PledgeModal/PledgeModal.tsx b/src/components/Tool/Appeal/Modals/PledgeModal/PledgeModal.tsx index a187df0db..b87d3df5d 100644 --- a/src/components/Tool/Appeal/Modals/PledgeModal/PledgeModal.tsx +++ b/src/components/Tool/Appeal/Modals/PledgeModal/PledgeModal.tsx @@ -410,14 +410,11 @@ export const PledgeModal: React.FC = ({ {t('Committed')} - {pledge?.status === - PledgeStatusEnum.ReceivedNotProcessed && ( - - {t('Received')} - - )} + + {t('Received')} + {pledge?.status === PledgeStatusEnum.Processed && ( {t('Given')}