Skip to content

Commit c1eaafe

Browse files
committed
WEB-4460 add tests for more menu
1 parent 7b8cf4c commit c1eaafe

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

  • __tests__/unit/app/pages/clinicworkspace/TideDashboardV2
  • app/pages/clinicworkspace/TideDashboardV2

__tests__/unit/app/pages/clinicworkspace/TideDashboardV2/Cells.test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,4 +267,34 @@ describe('Cells', () => {
267267
expect(screen.queryByText('Very Low')).not.toBeInTheDocument();
268268
});
269269
});
270+
271+
describe('MoreMenuCell', () => {
272+
it('dispatches the actions to open the Edit Patient dialog for the patient', async () => {
273+
renderComponent(<MoreMenuCell patient={patient} />);
274+
275+
expect(screen.queryByRole('button', { name: /Edit Patient Details/ })).not.toBeInTheDocument();
276+
await userEvent.click(screen.getByTestId('action-menu-patient-1-icon'));
277+
278+
await userEvent.click(screen.getByRole('button', { name: /Edit Patient Details/ }));
279+
280+
expect(store.getActions()).toStrictEqual([
281+
{ type: 'tideDashboard/setEditPatientDialogIsOpen', payload: true },
282+
{ type: 'tideDashboard/setEditPatientDialogPatientId', payload: 'patient-1' },
283+
]);
284+
});
285+
286+
it('dispatches the actions to open the Data Connections modal for the patient', async () => {
287+
renderComponent(<MoreMenuCell patient={patient} />);
288+
289+
expect(screen.queryByRole('button', { name: /Bring Data into Tidepool/ })).not.toBeInTheDocument();
290+
await userEvent.click(screen.getByTestId('action-menu-patient-1-icon'));
291+
292+
await userEvent.click(screen.getByRole('button', { name: /Bring Data into Tidepool/ }));
293+
294+
expect(store.getActions()).toStrictEqual([
295+
{ type: 'tideDashboard/setDataConnectionsModalIsOpen', payload: true },
296+
{ type: 'tideDashboard/setDataConnectionsModalPatientId', payload: 'patient-1' },
297+
]);
298+
});
299+
});
270300
});

app/pages/clinicworkspace/TideDashboardV2/Cells.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ export const MoreMenuCell = ({ patient }) => {
258258
return (
259259
<PopoverMenu
260260
id={`action-menu-${patient?.id}`}
261+
data-testid={`action-menu-${patient?.id}-icon`}
261262
items={[{
262263
icon: EditIcon,
263264
iconLabel: t('Edit Patient Details'),

0 commit comments

Comments
 (0)