diff --git a/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx b/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx index bd43e06a7..369008a1d 100644 --- a/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx +++ b/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx @@ -386,6 +386,42 @@ describe('TaskModalLogForm', () => { expect(getByRole('combobox', { name: 'Next Action' })).toBeInTheDocument(); }); + it('hides next action for results with no suggested next actions', async () => { + const { getByRole, findByRole, queryByRole } = render( + + + + + mocks={{ + LoadConstants, + }} + > + + + + + , + ); + + userEvent.click(getByRole('combobox', { name: 'Task Type' })); + userEvent.click(await findByRole('option', { name: 'Initiation' })); + + userEvent.click(getByRole('combobox', { name: 'Action' })); + userEvent.click(await findByRole('option', { name: 'In Person' })); + + userEvent.click(getByRole('combobox', { name: 'Result' })); + userEvent.click(await findByRole('option', { name: 'Not Interested' })); + + expect( + queryByRole('combobox', { name: 'Next Action' }), + ).not.toBeInTheDocument(); + }); + it('opens the next action modal', async () => { const mutationSpy = jest.fn(); const onClose = jest.fn(); diff --git a/src/components/Task/Modal/Form/possibleNextActions.ts b/src/components/Task/Modal/Form/possibleNextActions.ts index bc38da98b..456910d60 100644 --- a/src/components/Task/Modal/Form/possibleNextActions.ts +++ b/src/components/Task/Modal/Form/possibleNextActions.ts @@ -20,7 +20,7 @@ export const possibleNextActions = ( ) : null; - return result?.suggestedNextActions + return result?.suggestedNextActions?.length ? [ActivityTypeEnum.None, ...result.suggestedNextActions] : []; };