@openmrs/esm-active-visits-app 5.0.1-pre.1922 → 5.0.1-pre.1931
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/.turbo/turbo-build.log
CHANGED
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"active-visits-widget","slot":"homepage-widgets-slot","component":"activeVisits","order":0},{"name":"visit-summary-widget","slot":"visit-summary-slot","component":"visitDetail"}],"pages":[],"version":"5.0.1-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"active-visits-widget","slot":"homepage-widgets-slot","component":"activeVisits","order":0},{"name":"visit-summary-widget","slot":"visit-summary-slot","component":"visitDetail"}],"pages":[],"version":"5.0.1-pre.1931"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-active-visits-app",
|
|
3
|
-
"version": "5.0.1-pre.
|
|
3
|
+
"version": "5.0.1-pre.1931",
|
|
4
4
|
"description": "Active visits widget microfrontend for the OpenMRS SPA",
|
|
5
5
|
"browser": "dist/openmrs-esm-active-visits-app.js",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"webpack": "^5.74.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "e4bd0398bd79435a2ebafd77a50bbea17a613245"
|
|
54
54
|
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen, act } from '@testing-library/react';
|
|
3
|
+
import VisitDetailComponent from './visit-detail.component';
|
|
4
|
+
import { useVisit } from './visit.resource';
|
|
5
|
+
|
|
6
|
+
jest.mock('./visit.resource');
|
|
7
|
+
|
|
8
|
+
const mockedUseVisit = useVisit as jest.Mock;
|
|
9
|
+
|
|
10
|
+
describe('VisitDetailComponent', () => {
|
|
11
|
+
const visitUuid = '497b8b17-54ec-4726-87ec-3c4da8cdcaeb';
|
|
12
|
+
const patientUuid = '691eed12-c0f1-11e2-94be-8c13b969e334';
|
|
13
|
+
|
|
14
|
+
it('renders loading indicator when data is loading', () => {
|
|
15
|
+
mockedUseVisit.mockReturnValueOnce({
|
|
16
|
+
visit: null,
|
|
17
|
+
isLoading: true,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
render(<VisitDetailComponent visitUuid={visitUuid} patientUuid={patientUuid} />);
|
|
21
|
+
|
|
22
|
+
expect(screen.getByRole('progressbar')).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should render visit details and switches when data is available', () => {
|
|
26
|
+
mockedUseVisit.mockReturnValueOnce({
|
|
27
|
+
visit: {
|
|
28
|
+
uuid: visitUuid,
|
|
29
|
+
visitType: { display: 'Some Visit Type' },
|
|
30
|
+
startDatetime: '2023-07-29T12:34:56Z',
|
|
31
|
+
encounters: [],
|
|
32
|
+
},
|
|
33
|
+
isLoading: false,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
render(<VisitDetailComponent visitUuid={visitUuid} patientUuid={patientUuid} />);
|
|
37
|
+
|
|
38
|
+
expect(screen.getByText(/Some Visit Type/)).toBeInTheDocument();
|
|
39
|
+
expect(screen.getByText(/29-Jul-2023, 12:34 PM/)).toBeInTheDocument();
|
|
40
|
+
|
|
41
|
+
expect(screen.getByText('All Encounters')).toBeInTheDocument();
|
|
42
|
+
expect(screen.getByText('Visit Summary')).toBeInTheDocument();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should render EncounterLists when "All Encounters" switch is selected', () => {
|
|
46
|
+
mockedUseVisit.mockReturnValue({
|
|
47
|
+
visit: {
|
|
48
|
+
uuid: visitUuid,
|
|
49
|
+
visitType: { display: 'Some Visit Type' },
|
|
50
|
+
startDatetime: '2023-07-30T12:34:56Z',
|
|
51
|
+
encounters: [
|
|
52
|
+
{
|
|
53
|
+
uuid: 'encounter-1',
|
|
54
|
+
encounterDateTime: '2023-07-30T12:34:56Z',
|
|
55
|
+
encounterType: { display: 'Encounter Type' },
|
|
56
|
+
encounterProviders: [],
|
|
57
|
+
obs: [],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
isLoading: false,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
render(<VisitDetailComponent visitUuid={visitUuid} patientUuid={patientUuid} />);
|
|
65
|
+
|
|
66
|
+
act(() => {
|
|
67
|
+
screen.getByText('All Encounters').click();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
expect(screen.getByTestId('encountersTable')).toBeInTheDocument();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should render VisitSummaries when "Visit Summary" switch is selected', () => {
|
|
74
|
+
mockedUseVisit.mockReturnValue({
|
|
75
|
+
visit: {
|
|
76
|
+
uuid: visitUuid,
|
|
77
|
+
visitType: { display: 'Some Visit Type' },
|
|
78
|
+
startDatetime: '2023-07-30T12:34:56Z',
|
|
79
|
+
encounters: [
|
|
80
|
+
{
|
|
81
|
+
uuid: 'encounter-1',
|
|
82
|
+
encounterDateTime: '2023-07-30T12:34:56Z',
|
|
83
|
+
encounterType: { display: 'Encounter Type 1' },
|
|
84
|
+
encounterProviders: [],
|
|
85
|
+
obs: [],
|
|
86
|
+
orders: [],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
uuid: 'encounter-2',
|
|
90
|
+
encounterDateTime: '2023-07-30T13:45:00Z',
|
|
91
|
+
encounterType: { display: 'Encounter Type 2' },
|
|
92
|
+
encounterProviders: [],
|
|
93
|
+
obs: [],
|
|
94
|
+
orders: [],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
isLoading: false,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
render(<VisitDetailComponent visitUuid={visitUuid} patientUuid={patientUuid} />);
|
|
102
|
+
|
|
103
|
+
act(() => {
|
|
104
|
+
screen.getByText('Visit Summary').click();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
expect(screen.getByRole('tablist', { name: 'Visit summary tabs' })).toBeInTheDocument();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should render loading indicator when data is loading', () => {
|
|
111
|
+
mockedUseVisit.mockReturnValue({
|
|
112
|
+
visit: null,
|
|
113
|
+
isLoading: false,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
render(<VisitDetailComponent visitUuid={visitUuid} patientUuid={patientUuid} />);
|
|
117
|
+
|
|
118
|
+
expect(screen.queryByRole('button', { name: 'All Encounters' })).toBeNull();
|
|
119
|
+
});
|
|
120
|
+
});
|