diff --git a/src/components/Task/Modal/Form/Inputs/ResultAutocomplete/ResultAutocomplete.test.tsx b/src/components/Task/Modal/Form/Inputs/ResultAutocomplete/ResultAutocomplete.test.tsx index 0511726a8..566acef82 100644 --- a/src/components/Task/Modal/Form/Inputs/ResultAutocomplete/ResultAutocomplete.test.tsx +++ b/src/components/Task/Modal/Form/Inputs/ResultAutocomplete/ResultAutocomplete.test.tsx @@ -90,11 +90,15 @@ describe('ResultSelect', () => { completedAction: ActivityTypeEnum.FollowUpTextMessage, }); }); - it('preselects a result when only one result is available', () => { - const { getByRole } = render( - , - ); - expect(getByRole('combobox', { name: 'Result' })).toBeInTheDocument(); - expect(getByRole('combobox', { name: 'Result' })).toHaveValue('Attempted'); + it('preselects a result when only one result is available', async () => { + render(); + + expect(handleResultChange).toHaveBeenCalledWith({ + result: ResultEnum.Completed, + setFieldValue, + setResultSelected, + phaseData, + completedAction: ActivityTypeEnum.FollowUpTextMessage, + }); }); }); diff --git a/src/components/Task/Modal/Form/Inputs/ResultAutocomplete/ResultAutocomplete.tsx b/src/components/Task/Modal/Form/Inputs/ResultAutocomplete/ResultAutocomplete.tsx index c294f776a..a653700a3 100644 --- a/src/components/Task/Modal/Form/Inputs/ResultAutocomplete/ResultAutocomplete.tsx +++ b/src/components/Task/Modal/Form/Inputs/ResultAutocomplete/ResultAutocomplete.tsx @@ -40,6 +40,7 @@ export const ResultAutocomplete: React.FC = ({ setFieldValue, setResultSelected, phaseData, + completedAction, }); } }, [availableResults]); diff --git a/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx b/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx index 2803b3e07..f0a5e5aa2 100644 --- a/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx +++ b/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx @@ -177,7 +177,6 @@ describe('TaskModalLogForm', () => { expect(queryByLabelText('Comment')).not.toBeInTheDocument(); expect(queryByLabelText('Tags')).not.toBeInTheDocument(); expect(queryByLabelText('Assignee')).not.toBeInTheDocument(); - expect(queryByLabelText('Next Action')).not.toBeInTheDocument(); userEvent.click(getByLabelText('Show More')); expect(getByLabelText('Comment')).toBeInTheDocument(); userEvent.type(getByLabelText('Comment'), 'test comment'); diff --git a/src/components/Task/Modal/Form/TaskModalTests.tsx b/src/components/Task/Modal/Form/TaskModalTests.tsx index 2d971485e..fdf22e49e 100644 --- a/src/components/Task/Modal/Form/TaskModalTests.tsx +++ b/src/components/Task/Modal/Form/TaskModalTests.tsx @@ -16,6 +16,21 @@ type Components = ({ props, }: ComponentsProps) => JSX.Element; +const options = [ + 'None', + 'Phone Call', + 'Email', + 'Text Message', + 'Social Media', + 'In Person', + 'Thank You Note', + 'Digital Newsletter', + 'Physical Newsletter', + 'Prayer Request', + 'Update Information', + 'To Do', +]; + // eslint-disable-next-line jest/no-export export const taskModalTests = (Components: Components) => { describe('Task Modal Results +Next Action', () => { @@ -261,7 +276,7 @@ export const taskModalTests = (Components: Components) => { ActivityTypeEnum.PartnerCareEmail, ); expect(results).toEqual([]); - expect(nextActions).toEqual([]); + expect(nextActions).toEqual(options); }); it('as correct options for PartnerCarePhysicalNewsletter', async () => { @@ -269,7 +284,7 @@ export const taskModalTests = (Components: Components) => { ActivityTypeEnum.PartnerCarePhysicalNewsletter, ); expect(results).toEqual([]); - expect(nextActions).toEqual([]); + expect(nextActions).toEqual(options); }); it('has correct options for NONE', async () => { @@ -283,7 +298,7 @@ export const taskModalTests = (Components: Components) => { ActivityTypeEnum.PartnerCarePrayerRequest, ); expect(results).toEqual([]); - expect(nextActions).toEqual([]); + expect(nextActions).toEqual(options); }); it('has correct options for PartnerCarePhoneCall', async () => { @@ -291,7 +306,7 @@ export const taskModalTests = (Components: Components) => { ActivityTypeEnum.PartnerCarePhoneCall, ); expect(results).toEqual([]); - expect(nextActions).toEqual([]); + expect(nextActions).toEqual(options); }); it('has correct options for InitiationLetter', async () => { @@ -307,7 +322,7 @@ export const taskModalTests = (Components: Components) => { ActivityTypeEnum.PartnerCareThank, ); expect(results).toEqual([]); - expect(nextActions).toEqual([]); + expect(nextActions).toEqual(options); }); it('has correct options for PartnerCareToDo', async () => { @@ -315,7 +330,7 @@ export const taskModalTests = (Components: Components) => { ActivityTypeEnum.PartnerCareToDo, ); expect(results).toEqual([]); - expect(nextActions).toEqual([]); + expect(nextActions).toEqual(options); }); }); };