@openmrs/esm-patient-programs-app 3.0.0-pre.65 → 3.0.0-pre.656
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/133.openmrs-esm-patient-programs-app.js +3 -0
- package/dist/133.openmrs-esm-patient-programs-app.js.LICENSE.txt +14 -0
- package/dist/133.openmrs-esm-patient-programs-app.js.map +1 -0
- package/dist/401.openmrs-esm-patient-programs-app.js +3 -0
- package/dist/401.openmrs-esm-patient-programs-app.js.LICENSE.txt +14 -0
- package/dist/401.openmrs-esm-patient-programs-app.js.map +1 -0
- package/dist/574.openmrs-esm-patient-programs-app.js +1 -0
- package/dist/639.openmrs-esm-patient-programs-app.js +2 -0
- package/dist/639.openmrs-esm-patient-programs-app.js.map +1 -0
- package/dist/757.openmrs-esm-patient-programs-app.js +1 -0
- package/dist/783.openmrs-esm-patient-programs-app.js +3 -0
- package/dist/783.openmrs-esm-patient-programs-app.js.LICENSE.txt +23 -0
- package/dist/783.openmrs-esm-patient-programs-app.js.map +1 -0
- package/dist/839.openmrs-esm-patient-programs-app.js +2 -0
- package/dist/839.openmrs-esm-patient-programs-app.js.map +1 -0
- package/dist/972.openmrs-esm-patient-programs-app.js +2 -0
- package/dist/972.openmrs-esm-patient-programs-app.js.map +1 -0
- package/dist/openmrs-esm-patient-programs-app.js +2 -1
- package/dist/openmrs-esm-patient-programs-app.js.LICENSE.txt +5 -0
- package/dist/openmrs-esm-patient-programs-app.js.buildmanifest.json +220 -0
- package/dist/openmrs-esm-patient-programs-app.js.map +1 -1
- package/package.json +10 -11
- package/src/dashboard.meta.tsx +6 -0
- package/src/declarations.d.tsx +3 -3
- package/src/index.ts +31 -30
- package/src/programs/program-record.component.tsx +29 -48
- package/src/programs/program-record.test.outdated.tsx +30 -34
- package/src/programs/programs-detailed-summary.component.tsx +123 -114
- package/src/programs/programs-detailed-summary.scss +24 -0
- package/src/programs/programs-detailed-summary.test.tsx +71 -0
- package/src/programs/programs-form.component.tsx +257 -473
- package/src/programs/programs-form.scss +20 -0
- package/src/programs/programs-form.test.tsx +206 -0
- package/src/programs/programs-overview.component.tsx +44 -74
- package/src/programs/programs-overview.scss +4 -0
- package/src/programs/programs-overview.test.tsx +70 -0
- package/src/programs/programs.component.test.tsx +21 -0
- package/src/programs/programs.component.tsx +6 -10
- package/src/programs/programs.context.tsx +1 -1
- package/src/programs/programs.resource.tsx +31 -43
- package/translations/en.json +29 -1
- package/webpack.config.js +1 -80
- package/dist/0.openmrs-esm-patient-programs-app.js +0 -22
- package/dist/0.openmrs-esm-patient-programs-app.js.map +0 -1
- package/dist/1.openmrs-esm-patient-programs-app.js +0 -2
- package/dist/1.openmrs-esm-patient-programs-app.js.map +0 -1
- package/dist/3.openmrs-esm-patient-programs-app.js +0 -23
- package/dist/3.openmrs-esm-patient-programs-app.js.map +0 -1
- package/dist/4.openmrs-esm-patient-programs-app.js +0 -2
- package/dist/4.openmrs-esm-patient-programs-app.js.map +0 -1
- package/dist/5.openmrs-esm-patient-programs-app.js +0 -2
- package/dist/5.openmrs-esm-patient-programs-app.js.map +0 -1
- package/dist/6.openmrs-esm-patient-programs-app.js +0 -2
- package/dist/6.openmrs-esm-patient-programs-app.js.map +0 -1
- package/dist/7.openmrs-esm-patient-programs-app.js +0 -2
- package/dist/7.openmrs-esm-patient-programs-app.js.map +0 -1
- package/dist/8.openmrs-esm-patient-programs-app.js +0 -2
- package/dist/8.openmrs-esm-patient-programs-app.js.map +0 -1
- package/src/cards/summary-card.component.tsx +0 -82
- package/src/cards/summary-card.css +0 -65
- package/src/dashboard/dashboard-link.component.tsx +0 -7
- package/src/dashboard/dashboard.meta.tsx +0 -6
- package/src/openmrs-backend-dependencies.ts +0 -4
- package/src/programs/empty-state/empty-data-illustration.component.tsx +0 -53
- package/src/programs/empty-state/empty-state.component.tsx +0 -39
- package/src/programs/empty-state/empty-state.scss +0 -34
- package/src/programs/error-state/error-state.component.tsx +0 -26
- package/src/programs/error-state/error-state.scss +0 -36
- package/src/programs/openWorkspaceTab.tsx +0 -40
- package/src/programs/programs-detailed-summary.css +0 -63
- package/src/programs/programs-detailed-summary.test.outdated.tsx +0 -57
- package/src/programs/programs-form.css +0 -95
- package/src/programs/programs-form.test.outdated.tsx +0 -276
- package/src/programs/programs-overview.test.outdated.tsx +0 -73
- package/src/programs/programs.component.test.outdated.tsx +0 -18
- package/src/set-public-path.ts +0 -3
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ProgramsDetailedSummary from './programs-detailed-summary.component';
|
|
3
|
+
import { cleanup, render, RenderResult, screen } from '@testing-library/react';
|
|
4
|
+
import { mockEnrolledProgramsResponse } from '../../../../__mocks__/programs.mock';
|
|
5
|
+
import * as mockProgramContext from './programs.context';
|
|
6
|
+
import * as mockProgramsResource from './programs.resource';
|
|
7
|
+
import { mockPatient } from '../../../../__mocks__/patient.mock';
|
|
8
|
+
import { of, throwError } from 'rxjs';
|
|
9
|
+
|
|
10
|
+
describe('<ProgramsDetailedSummary />', () => {
|
|
11
|
+
afterEach(cleanup);
|
|
12
|
+
let wrapper: RenderResult;
|
|
13
|
+
const renderDetailedPrograms = () => {
|
|
14
|
+
spyOn(mockProgramsResource, 'fetchEnrolledPrograms').and.returnValue(of(mockEnrolledProgramsResponse));
|
|
15
|
+
spyOn(mockProgramContext, 'useProgramsContext').and.returnValue({
|
|
16
|
+
patient: mockPatient,
|
|
17
|
+
patientUuid: mockPatient.id,
|
|
18
|
+
});
|
|
19
|
+
wrapper = render(<ProgramsDetailedSummary />);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const renderEmptyStatePrograms = () => {
|
|
23
|
+
spyOn(mockProgramsResource, 'fetchEnrolledPrograms').and.returnValue(of([]));
|
|
24
|
+
spyOn(mockProgramContext, 'useProgramsContext').and.returnValue({
|
|
25
|
+
patient: mockPatient,
|
|
26
|
+
patientUuid: mockPatient.id,
|
|
27
|
+
});
|
|
28
|
+
wrapper = render(<ProgramsDetailedSummary />);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const renderErrorStateProgram = () => {
|
|
32
|
+
spyOn(mockProgramsResource, 'fetchEnrolledPrograms').and.returnValue(throwError('loading error'));
|
|
33
|
+
spyOn(mockProgramContext, 'useProgramsContext').and.returnValue({
|
|
34
|
+
patient: mockPatient,
|
|
35
|
+
patientUuid: mockPatient.id,
|
|
36
|
+
});
|
|
37
|
+
wrapper = render(<ProgramsDetailedSummary />);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
it("displays a detailed summary of the patient's program enrollments", async () => {
|
|
41
|
+
renderDetailedPrograms();
|
|
42
|
+
await screen.findByRole('heading', { name: /Care Programs/i });
|
|
43
|
+
expect(screen.getByText(/Care Programs/i)).toBeInTheDocument();
|
|
44
|
+
|
|
45
|
+
expect(screen.getByText('Active programs')).toBeInTheDocument();
|
|
46
|
+
expect(screen.getByText('Date enrolled')).toBeInTheDocument();
|
|
47
|
+
expect(screen.getByText('Status')).toBeInTheDocument();
|
|
48
|
+
expect(screen.getByText('HIV Care and Treatment')).toBeInTheDocument();
|
|
49
|
+
expect(screen.getByText('Jan-2020')).toBeInTheDocument();
|
|
50
|
+
expect(screen.getByText('Active')).toBeInTheDocument();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('renders an empty state view when program enrollment data is absent', async () => {
|
|
54
|
+
renderEmptyStatePrograms();
|
|
55
|
+
screen.findByRole('heading', { name: /Care Programs/i });
|
|
56
|
+
expect(screen.getByText(/Care Programs/i)).toBeInTheDocument();
|
|
57
|
+
|
|
58
|
+
expect(screen.getByText(/There are no program enrollments to display for this patient/)).toBeInTheDocument();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('renders an error state, when an error occurs while loading data', () => {
|
|
62
|
+
renderErrorStateProgram();
|
|
63
|
+
expect(screen.getByText(/Care Programs/i)).toBeInTheDocument();
|
|
64
|
+
|
|
65
|
+
expect(
|
|
66
|
+
screen.getByText(
|
|
67
|
+
/Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above./,
|
|
68
|
+
),
|
|
69
|
+
).toBeInTheDocument();
|
|
70
|
+
});
|
|
71
|
+
});
|