Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
36223c1
WEB-4460 initialize base branch
henry-tp Aug 18, 2026
7efc2ae
WEB-4460 add new adapter components to dashboard
henry-tp Aug 17, 2026
95d2fc8
WEB-4460 remove DataRecencyType from Data Recency dropdown via prop
henry-tp Aug 17, 2026
0f7777c
WEB-4460 add 14 day Data Recency option in TIDE
henry-tp Aug 20, 2026
05e0d7a
WEB-4460 alter styling for non-removable filters
henry-tp Aug 20, 2026
b5ad6d9
WEB-4460 add TIDE to metric source
henry-tp Aug 20, 2026
0d03e58
Revert "WEB-4460 delete work related to filter persistence to move it…
henry-tp Aug 20, 2026
0f6d6db
WEB-4460 fix rebase errors
henry-tp Aug 20, 2026
fd5d7f0
WEB-4460 fix useDerivedDataRecency hook to use redux
henry-tp Aug 24, 2026
ee13228
WEB-4460 add required filters to ActiveFilterTray
henry-tp Aug 24, 2026
74760ca
WEB-4460 add tests for filters and emptycontent
henry-tp Aug 24, 2026
a517b71
WEB-4460 add tests for usePruneInvalidFilters
henry-tp Aug 24, 2026
d7b0858
WEB-4460 migrate tests for async actions
henry-tp Aug 25, 2026
307b6bc
WEB-4460 add tests for localStorage persistence from configureStore
henry-tp Aug 25, 2026
de0e43d
WEB-4460 use more conventional style of redux action in tests
henry-tp Aug 25, 2026
eca01fd
WEB-4460 add test for DEFAULT_WITH_FILTERS
henry-tp Aug 27, 2026
ebd8d92
WEB-4460 re-run prune hook on clinic change
henry-tp Aug 28, 2026
eb3fae7
WEB-4460 move filters into directory
henry-tp Aug 31, 2026
9acb0eb
WEB-4460 organize filters into specific directory
henry-tp Aug 31, 2026
84dc690
WEB-4460 group requiredFilters for clarity
henry-tp Sep 1, 2026
cdf6af3
WEB-4460 address automated comment feedback
henry-tp Sep 4, 2026
446e53e
WEB-4460 use atomic state setting for tideDashboardFilters
henry-tp Sep 4, 2026
a6c04f2
WEB-4460 remove dup import
henry-tp Sep 6, 2026
0ec14af
WEB-4460 initialize base branch
henry-tp Aug 18, 2026
f1d36e1
WEB-4460 add cell data to table
henry-tp Aug 17, 2026
caa51ad
WEB-4460 fix chained fn indent
henry-tp Aug 17, 2026
b9bdd63
WEB-4460 add in table columns
henry-tp Aug 18, 2026
2c3b7d8
WEB-4460 tie flag rules to CGM Exclusion Query
henry-tp Aug 20, 2026
cd39d29
WEB-4460 shorten flag labels
henry-tp Aug 20, 2026
b9f64e1
WEB-4460 fix CATEGORY enum import
henry-tp Aug 20, 2026
cd17b3d
WEB-4460 abstract out columnSets definition
henry-tp Aug 25, 2026
0d6f854
WEB-4460 expect correct columns per category
henry-tp Aug 25, 2026
1e2284b
WEB-4460 add tests for cells
henry-tp Aug 25, 2026
1ba2195
WEB-4460 remove MoreMenu to be implemented later
henry-tp Aug 25, 2026
783e911
WEB-4460 remove unused imports
henry-tp Aug 25, 2026
fc7579b
WEB-4460 fix tideDashboardExclusionQuery naming issue
henry-tp Aug 27, 2026
9c52c0a
WEB-4460 fix var naming error for tideDashboardExclusionQuery
henry-tp Aug 27, 2026
73d8a25
WEB-4460 fix var naming error for tideDashboardExclusionQuery
henry-tp Aug 27, 2026
59f787c
WEB-4460 add tests for FlagCell
henry-tp Aug 29, 2026
15f880e
WEB-4460 fix units for AvgGlucoseCell
henry-tp Sep 1, 2026
4cf026b
WEB-4460 rename table building functions
henry-tp Sep 1, 2026
cf20a82
WEB-4460 update table columsn to match designs
henry-tp Sep 1, 2026
d4170ea
WEB-4460 fix tests
henry-tp Sep 1, 2026
dac4c54
WEB-4460 fix tests
henry-tp Sep 1, 2026
44597e1
WEB-4460 remove flag from all columns except default
henry-tp Sep 2, 2026
1281e01
WEB-4460 address automated feedback
henry-tp Sep 4, 2026
f04a79a
WEB-4460 initial clinic query setup
henry-tp Aug 29, 2026
97997d9
WEB-4460 replace redux clinic refs with useClinic
henry-tp Aug 29, 2026
fe888c5
WEB-4460 modify some filters to use useClinic hook
henry-tp Aug 29, 2026
56b312e
WEB-4460 replace clinic using useClinic in filter prune
henry-tp Aug 29, 2026
cd1d3c8
WEB-4460 return isClinicAdmin from hook
henry-tp Aug 29, 2026
4fa84a5
WEB-4460 replace all useIsClinicAdmin to use API response
henry-tp Aug 29, 2026
fdf48c8
WEB-4460 refetch clinic where needed
henry-tp Aug 29, 2026
dbfd70c
WEB-4460 strip out unneeded invalidations
henry-tp Aug 29, 2026
ec3499a
WEB-4460 initialize base branch
henry-tp Aug 18, 2026
2e4803f
WEB-4460 abstract ReviewPatientToggle component
henry-tp Aug 17, 2026
e3c371f
WEB-4460 implement PatientLastReviewed Cell in table
henry-tp Aug 17, 2026
07bf90e
WEB-4460 fix Menubar implementation of PatientLastReviewed
henry-tp Aug 17, 2026
f8f84d3
WEB-4460 move last reviewed calls to own api slice
henry-tp Aug 18, 2026
c4aaf8e
WEB-4460 update last review implementation on ClinicPatients to match…
henry-tp Aug 18, 2026
3246689
WEB-4460 use review api response to update view
henry-tp Aug 19, 2026
0b643fc
WEB-4460 rename methods and use barrel file for export
henry-tp Aug 19, 2026
57d5325
WEB-4460 fix method names for marking / undoing
henry-tp Aug 19, 2026
cfc354c
WEB-4460 handleUndo does not function if processing
henry-tp Aug 19, 2026
07d37cd
WEB-4460 fix broken import
henry-tp Aug 25, 2026
e2f5f2c
WEB-4460 fix tests for Menu bar
henry-tp Aug 26, 2026
1e8e0b9
WEB-4460 add tests for PatientLastReviewed and migrate some tests for…
henry-tp Aug 26, 2026
3e6a443
WEB-4460 add tests for ReviewPatientToggle
henry-tp Aug 26, 2026
4cc1d08
WEB-4460 add tests for PatientLastReviewed
henry-tp Aug 27, 2026
341c1cb
WEB-4460 MenuBar uses correct PatientLastReviewed with correct props
henry-tp Aug 27, 2026
36c5fcc
WEB-4460 remove patient drawer api file
henry-tp Aug 27, 2026
5326653
WEB-4460 move PatientLastReviewed to a generic adapter in PatientLast…
henry-tp Aug 27, 2026
8f7b58c
WEB-4460 fix test location
henry-tp Aug 27, 2026
6f27308
WEB-4460 fix broken tests
henry-tp Aug 27, 2026
dc5ff29
WEB-4460 remove TideDashboard references to make more Generic Patient…
henry-tp Aug 27, 2026
26c04a0
WEB-4460 revert changes accidentally brought in from rebase
henry-tp Aug 31, 2026
a74a368
WEB-4460 rename to PatientLastReviewed Generic Adapter
henry-tp Sep 1, 2026
ae95cca
WEB-4460 call generic adapter directly in cells
henry-tp Sep 1, 2026
814293c
WEB-4460 address automated review feedback
henry-tp Sep 4, 2026
f733f9b
WEB-4460 fix breaking test
henry-tp Sep 4, 2026
f2e21a5
WEB-4460 initialize base branch
henry-tp Aug 18, 2026
3af6305
WEB-4460 update modals
henry-tp Aug 17, 2026
2ef2678
WEB-4460 add modal controllers to dashboard
henry-tp Aug 17, 2026
007de0d
WEB-4460 re-add in more menu
henry-tp Aug 25, 2026
09fa0a1
WEB-4460 fix EditPatientDialog tests
henry-tp Aug 27, 2026
95cbb29
WEB-4460 fix breaking tests
henry-tp Aug 27, 2026
86d1cc4
WEB-4460 add tests for more menu
henry-tp Aug 27, 2026
7dd566a
WEB-4460 move modals into directory
henry-tp Aug 31, 2026
26147d0
WEB-4460 abstract Edit Patient Dialog
henry-tp Sep 2, 2026
c73e44a
WEB-4460 add new tests for abstract modal
henry-tp Sep 2, 2026
ee6d1d8
WEB-4460 use convention for handler names
henry-tp Sep 2, 2026
155e991
WEB-4460 fix imports
henry-tp Sep 2, 2026
8ada273
WEB-4460 address automated review feedback
henry-tp Sep 4, 2026
0100ed6
WEB-4460 pull in PatientDrawer
henry-tp Aug 18, 2026
fc74a59
WEB-4460 move PatientDrawer directory to components
henry-tp Aug 18, 2026
bb86061
WEB-4460 update drawer import directories
henry-tp Aug 18, 2026
ec006b3
WEB-4460 fix MenuBar pulling in correct PatientLastReviewed
henry-tp Aug 18, 2026
bfb5d9f
WEB-4460 add MenuBar PatientLastReviewed
henry-tp Aug 19, 2026
c6251ee
WEB-4460 wrap lastReviewed in a container that calls stopPropogation()
henry-tp Aug 19, 2026
ad189e4
WEB-4460 add back in patientDrawerApi
henry-tp Aug 27, 2026
887f560
WEB-4460 fix breaking tests due to modified directory structure
henry-tp Aug 27, 2026
d5cae07
WEB-4460 menubar uses generic `PatientLastReviewed` adapter
henry-tp Aug 27, 2026
73314b9
WEB-4460 update tests for MenuBar
henry-tp Aug 27, 2026
4f992d7
WEB-4460 fix failing tests
henry-tp Aug 28, 2026
a5aa1e1
WEB-4460 fix breaking drawer due to patient not being in redux state
henry-tp Sep 1, 2026
ffe084c
WEB-4460 fix tests for drawer components
henry-tp Sep 1, 2026
97d39c1
WEB-4460 fix PatientLastReviewed import with generic adapter
henry-tp Sep 1, 2026
ccbeaf1
WEB-4460 remove unneeded Drawer Api
henry-tp Sep 1, 2026
7dce7d2
WEB-4460 address automated review feedback
henry-tp Sep 4, 2026
1e59521
WEB-4460 fix import error
henry-tp Sep 6, 2026
8b2a6b4
WEB-4460 initialize base branch
henry-tp Aug 18, 2026
73d83aa
WEB-4460 add modal controllers
henry-tp Aug 17, 2026
5b1733a
WEB-4460 add Data Issues segment
henry-tp Aug 17, 2026
c6e2d8a
WEB-4460 fix refactor dropped lines
henry-tp Aug 20, 2026
1c2f77f
WEB-4460 add PatientLastReviewed to Data Issues
henry-tp Aug 28, 2026
5d0c2bc
WEB-4460 add tests for Data Issues
henry-tp Aug 28, 2026
28d9fe6
WEB-4460 fix tests
henry-tp Aug 28, 2026
f04ef5a
WEB-4460 fix DataConnections cell size
henry-tp Aug 29, 2026
68134d9
WEB-4460 use generic adapter for data issues cells
henry-tp Sep 1, 2026
a91deb5
WEB-4460 fix table test to search within patients table
henry-tp Sep 1, 2026
cd75cfd
WEB-4460 fix sites not being passed
henry-tp Sep 1, 2026
95e1b00
WEB-4460 address automated review feedback
henry-tp Sep 4, 2026
34c1b35
WEB-4454 initial commit
henry-tp Sep 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions __tests__/unit/app/components/clinic/PatientLastReviewed.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/* global jest, beforeEach, describe, it, expect */

import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import { MemoryRouter } from 'react-router-dom';
import { thunk } from 'redux-thunk';
import moment from 'moment';

import { ToastProvider } from '@app/providers/ToastProvider';
import PatientLastReviewed from '@app/components/clinic/PatientLastReviewed';

// metricUtils must be imported relatively — the @app alias resolves to the real module
import { trackMetric as mockTrackMetric } from '../../../../../app/core/metricUtils';

describe('PatientLastReviewed', () => {
// Review times are formatted against the real clock, so anchor the fixtures to the current moment
const today = moment().toISOString();
const yesterday = moment().subtract(1, 'day').toISOString();

const defaultWorkingState = {
inProgress: false,
completed: null,
notification: null,
};

const defaultState = {
blip: {
loggedInUserId: 'user2',
selectedClinicId: 'clinic7',
clinics: {
clinic7: {
id: 'clinic7',
patients: {
patient1: { id: 'patient1', reviews: [{ clinicianId: 'user2', time: today }, { clinicianId: 'user2', time: yesterday }] },
patient2: { id: 'patient2', reviews: [{ clinicianId: 'user2', time: yesterday }] },
},
},
},
working: {
settingClinicPatientLastReviewed: defaultWorkingState,
revertingClinicPatientLastReviewed: defaultWorkingState,
},
},
};

const api = {
clinics: {
setClinicPatientLastReviewed: jest.fn(),
revertClinicPatientLastReviewed: jest.fn(),
},
};

const mockStore = configureStore([thunk]);
let store;

const ui = (props = {}) => (
<Provider store={store}>
<MemoryRouter initialEntries={['/clinic-workspace']}>
<ToastProvider>
<PatientLastReviewed api={api} patientId="patient1" {...props} />
</ToastProvider>
</MemoryRouter>
</Provider>
);

const renderComponent = (props = {}) => render(ui(props));

beforeEach(() => {
store = mockStore(defaultState);

api.clinics.setClinicPatientLastReviewed.mockReset();
api.clinics.revertClinicPatientLastReviewed.mockReset();

api.clinics.setClinicPatientLastReviewed.mockImplementation((cId, pId, cb) => cb(null, [today, yesterday]));
api.clinics.revertClinicPatientLastReviewed.mockImplementation((cId, pId, cb) => cb(null, [yesterday]));

mockTrackMetric.mockClear();
});

it('allows marking a patient as reviewed', async () => {
renderComponent({ patientId: 'patient2' });

expect(screen.getByText('Yesterday')).toBeInTheDocument();

await userEvent.click(screen.getByRole('button', { name: /Mark Reviewed/ }));

await waitFor(() => expect(api.clinics.setClinicPatientLastReviewed).toHaveBeenCalled());

expect(mockTrackMetric).toHaveBeenCalledWith('Clinic - Mark patient reviewed', {
clinicId: 'clinic7',
patientID: 'patient2',
pageName: 'Population Health',
});

expect(api.clinics.setClinicPatientLastReviewed).toHaveBeenCalledWith(
'clinic7',
'patient2',
expect.any(Function),
);

expect(store.getActions()).toStrictEqual([
{ type: 'SET_CLINIC_PATIENT_LAST_REVIEWED_REQUEST' },
{
type: 'SET_CLINIC_PATIENT_LAST_REVIEWED_SUCCESS',
payload: { clinicId: 'clinic7', patientId: 'patient2', reviews: [today, yesterday] },
},
]);
});

it('allows undoing a review marked earlier today', async () => {
renderComponent({ patientId: 'patient1' });

expect(screen.getByText('Today')).toBeInTheDocument();

await userEvent.click(screen.getByRole('button', { name: /Undo/ }));

await waitFor(() => expect(api.clinics.revertClinicPatientLastReviewed).toHaveBeenCalled());

expect(mockTrackMetric).toHaveBeenCalledWith('Clinic - Undo mark patient reviewed', {
clinicId: 'clinic7',
patientID: 'patient1',
pageName: 'Population Health',
});

expect(api.clinics.revertClinicPatientLastReviewed).toHaveBeenCalledWith(
'clinic7',
'patient1',
expect.any(Function),
);

expect(store.getActions()).toStrictEqual([
{ type: 'REVERT_CLINIC_PATIENT_LAST_REVIEWED_REQUEST' },
{
type: 'REVERT_CLINIC_PATIENT_LAST_REVIEWED_SUCCESS',
payload: { clinicId: 'clinic7', patientId: 'patient1', reviews: [yesterday] },
},
]);
});
});
8 changes: 4 additions & 4 deletions __tests__/unit/app/components/navpatientheader/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React from 'react';
import { Provider } from 'react-redux';
import { render, screen } from '@testing-library/react';
import { render, screen, within } from '@testing-library/react';
import _ from 'lodash';
import configureStore from 'redux-mock-store';
import { thunk } from 'redux-thunk';
Expand Down Expand Up @@ -39,7 +39,7 @@ jest.mock('@app/providers/ToastProvider', () => ({

describe('NavPatientHeader', () => {
const trackMetric = jest.fn();
const api = {};
const api = { clinics: { getPatientFromClinic: jest.fn() } };

const patientProps = {
userid: '1234',
Expand Down Expand Up @@ -191,7 +191,7 @@ describe('NavPatientHeader', () => {
expect(screen.getByText(/Naoya Inoue/)).toBeInTheDocument();
expect(screen.getByText(/999999/)).toBeInTheDocument();
expect(screen.getByText(/1965-01-01/)).toBeInTheDocument();
expect(screen.getByText(/Pre-diabetes/)).toBeInTheDocument();
expect(within(screen.getByTestId('nav-patient-header')).getByText(/Pre-diabetes/)).toBeInTheDocument();

// should NOT show demographic info from the 'patient' object
expect(screen.queryByText(/Vasyl Lomachenko/)).not.toBeInTheDocument();
Expand Down Expand Up @@ -228,7 +228,7 @@ describe('NavPatientHeader', () => {
expect(screen.getByText(/Naoya Inoue/)).toBeInTheDocument();
expect(screen.getByText(/999999/)).toBeInTheDocument();
expect(screen.getByText(/1965-01-01/)).toBeInTheDocument();
expect(screen.getByText(/Pre-diabetes/)).toBeInTheDocument();
expect(within(screen.getByTestId('nav-patient-header')).getByText(/Pre-diabetes/)).toBeInTheDocument();

// should NOT show demographic info from the 'patient' object
expect(screen.queryByText(/Vasyl Lomachenko/)).not.toBeInTheDocument();
Expand Down
Loading