Skip to content

Commit

Permalink
fixing tests that broke to the merge conflict fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-bizz committed Aug 22, 2024
1 parent 4e6f858 commit 43047d2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const Components = ({ router = defaultRouter }: { router?: object }) => (
);

describe('Appeal navigation', () => {
it('should show list detail appeal page and open filters', async () => {
it('should show list detail appeal page and close filters', async () => {
const { getByText, findByTestId, queryByText, getByRole, queryByRole } =
render(
<Components
Expand All @@ -134,16 +134,6 @@ describe('Appeal navigation', () => {
await waitFor(() => expect(getByText('Test Person')).toBeInTheDocument());
expect(await findByTestId('rowButton')).toHaveTextContent(contact.name);

expect(queryByRole('heading', { name: 'Given' })).not.toBeInTheDocument();
expect(
queryByRole('heading', { name: 'Received' }),
).not.toBeInTheDocument();
expect(
queryByRole('heading', { name: 'Committed' }),
).not.toBeInTheDocument();

userEvent.click(getByRole('img', { name: 'Toggle Filter Panel' }));

await waitFor(() => {
expect(getByRole('heading', { name: 'Given' })).toBeInTheDocument();
expect(getByRole('heading', { name: 'Received' })).toBeInTheDocument();
Expand All @@ -156,6 +146,18 @@ describe('Appeal navigation', () => {
getByRole('heading', { name: 'Export Emails' }),
).toBeInTheDocument();
});

userEvent.click(getByRole('img', { name: 'Toggle Filter Panel' }));

await waitFor(() => {
expect(queryByRole('heading', { name: 'Given' })).not.toBeInTheDocument();
expect(
queryByRole('heading', { name: 'Received' }),
).not.toBeInTheDocument();
expect(
queryByRole('heading', { name: 'Committed' }),
).not.toBeInTheDocument();
});
});

it('should show flows detail appeal page and open filters', async () => {
Expand Down
25 changes: 13 additions & 12 deletions src/components/Tool/Appeal/AppealsDetailsPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,18 @@ const Components = ({ router = defaultRouter }: { router?: object }) => (
describe('AppealsDetailsPage', () => {
describe('Contact drawer', () => {
it('should open and close on List view', async () => {
const { getByText, findByTestId, getByRole, queryByRole } = render(
<Components
router={{
...defaultRouter,
query: {
...defaultRouter.query,
appealId: ['1', 'list'],
},
}}
/>,
);
const { getByText, findByTestId, getByRole, queryByRole, getAllByRole } =
render(
<Components
router={{
...defaultRouter,
query: {
...defaultRouter.query,
appealId: ['1', 'list'],
},
}}
/>,
);

await waitFor(() => expect(getByText('Test Person')).toBeInTheDocument());

Expand All @@ -140,7 +141,7 @@ describe('AppealsDetailsPage', () => {
expect(getByRole('tab', { name: 'Tasks' })).toBeInTheDocument(),
);

userEvent.click(getByRole('img', { name: 'Close' }));
userEvent.click(getAllByRole('img', { name: 'Close' })[0]);

await waitFor(() =>
expect(queryByRole('tab', { name: 'Tasks' })).not.toBeInTheDocument(),
Expand Down
14 changes: 9 additions & 5 deletions src/components/Tool/Appeal/List/ContactRow/ContactRow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,16 @@ describe('ContactsRow', () => {
expect(setContactFocus).toHaveBeenCalledWith(contact.id);
});

it('should rendered checked', () => {
isRowChecked.mockImplementationOnce(() => true);
it('should render contact select event', () => {
isRowChecked.mockImplementationOnce((id) => id === contact.id);

const { getByRole } = render(<Components />);
const { getByTestId } = render(<Components />);

const checkbox = getByRole('checkbox');
expect(checkbox).toBeChecked();
expect(setContactFocus).not.toHaveBeenCalled();

const rowButton = getByTestId('rowButton');
userEvent.click(rowButton);

expect(setContactFocus).toHaveBeenCalledWith(contact.id);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ describe('FixMailingAddresses', () => {
InvalidAddresses: {
...mockInvalidAddressesResponse.InvalidAddresses,
},
UpdateContactMailingAddress: () => {
UpdateContactAddress: () => {
throw new Error('Server Error');
},
}}
Expand Down Expand Up @@ -519,7 +519,7 @@ describe('FixMailingAddresses', () => {
],
},
},
UpdateContactMailingAddress: () => {
UpdateContactAddress: () => {
throw new Error('Server Error');
},
}}
Expand Down

0 comments on commit 43047d2

Please sign in to comment.