Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
usamaidrsk committed Jul 30, 2024
1 parent 5cee9b0 commit 5e2854a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const WardPatientCard: React.FC<WardPatientCardProps> = (props) => {
// activeBedSelection?.patient.uuid === props.patient?.uuid,
})}
onClick={() => {
launchWorkspace('ward-patient-notes-workspace', { ...props });
launchWorkspace('ward-patient-workspace', { ...props });
}}>
{/* Name will not be displayed; just there for a11y */}
{getPatientName(props.patient.person)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { showSnackbar, useSession } from '@openmrs/esm-framework';
import { savePatientNote } from './notes-form.resource';
import PatientNotesForm from './notes-form.component';
import { emrApiConfigMock, mockPatient, mockSession } from '__mocks__';
import useEmrConfiguration from '../../../hooks/useEmrConfiguration';

const testProps = {
patientUuid: mockPatient.uuid,
Expand All @@ -31,14 +32,22 @@ jest.mock('@openmrs/esm-framework', () => {
};
});

jest.mock('../../../hooks/useEmrApiConfig', () => ({
useEmrApiConfig: jest.fn().mockReturnValue(() => ({ emrApiConfig: emrApiConfigMock })),
}));

jest.mock('./notes-form.resource', () => ({
savePatientNote: jest.fn(),
}));

jest.mock('../../../hooks/useEmrConfiguration', () => ({
__esModule: true,
default: jest.fn(),
}));

(useEmrConfiguration as jest.Mock).mockReturnValue({
emrConfiguration: emrApiConfigMock,
mutateEmrConfiguration: jest.fn(),
isLoadingEmrConfiguration: false,
errorFetchingEmrConfiguration: null,
});

test('renders the visit notes form with all the relevant fields and values', () => {
renderWardPatientNotesForm();

Expand Down
2 changes: 2 additions & 0 deletions packages/esm-ward-app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"errorLoadingPatients": "Error loading admitted patients",
"errorLoadingWardLocation": "Error loading ward location",
"failedToLoadPatientWorkspace": "Ward patient workspace has failed to load.",
"fetchingEmrConfigurationFailed": "Fetching EMR configuration failed. Try refreshing the page or contact your system administrator.",
"invalidLocationSpecified": "Invalid location specified",
"invalidWardLocation": "Invalid ward location: {{location}}",
"manage": "Manage",
Expand All @@ -18,6 +19,7 @@
"patientNoteSaveError": "Error saving patient note",
"save": "Save",
"saving": "Saving...",
"somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
"visitNoteSaved": "Patient note saved",
"wardClinicalNotePlaceholder": "Write any notes here",
"wardPatientWorkspaceTitle": "Ward Patient",
Expand Down

0 comments on commit 5e2854a

Please sign in to comment.