@openmrs/esm-active-visits-app 8.0.3-pre.4473 → 8.0.3-pre.4475
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"},{"name":"active-visits-tile","slot":"home-metrics-tiles-slot","component":"homeActiveVisitsTile"},{"name":"total-visits-tile","slot":"home-metrics-tiles-slot","component":"homeTotalVisitsTile"}],"pages":[],"version":"8.0.3-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"},{"name":"active-visits-tile","slot":"home-metrics-tiles-slot","component":"homeActiveVisitsTile"},{"name":"total-visits-tile","slot":"home-metrics-tiles-slot","component":"homeTotalVisitsTile"}],"pages":[],"version":"8.0.3-pre.4475"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
|
-
import { formatDate } from '@openmrs/esm-framework';
|
|
5
4
|
import { useVisit } from './visit.resource';
|
|
6
5
|
import VisitDetailComponent from './visit-detail.component';
|
|
7
6
|
|
|
7
|
+
const mockUseVisit = jest.mocked(useVisit);
|
|
8
8
|
const defaultProps = {
|
|
9
9
|
patientUuid: '691eed12-c0f1-11e2-94be-8c13b969e334',
|
|
10
10
|
visitUuid: '497b8b17-54ec-4726-87ec-3c4da8cdcaeb',
|
|
11
11
|
};
|
|
12
|
-
const mockUseVisit = jest.mocked(useVisit);
|
|
13
12
|
|
|
14
|
-
jest.mock('./visit.resource')
|
|
13
|
+
jest.mock('./visit.resource', () => ({
|
|
14
|
+
...jest.requireActual('./visit.resource'),
|
|
15
|
+
useVisit: jest.fn(),
|
|
16
|
+
}));
|
|
15
17
|
|
|
16
18
|
describe('VisitDetail', () => {
|
|
17
19
|
it('renders a loading spinner when data is loading', () => {
|
|
18
|
-
mockUseVisit.
|
|
20
|
+
mockUseVisit.mockReturnValue({
|
|
19
21
|
visit: null,
|
|
20
22
|
error: undefined,
|
|
21
23
|
isLoading: true,
|
|
@@ -29,7 +31,8 @@ describe('VisitDetail', () => {
|
|
|
29
31
|
|
|
30
32
|
it('renders a visit detail overview when data is available', () => {
|
|
31
33
|
const mockVisitDate = new Date();
|
|
32
|
-
|
|
34
|
+
|
|
35
|
+
mockUseVisit.mockReturnValue({
|
|
33
36
|
visit: {
|
|
34
37
|
encounters: [],
|
|
35
38
|
startDatetime: mockVisitDate.toISOString(),
|
|
@@ -43,13 +46,14 @@ describe('VisitDetail', () => {
|
|
|
43
46
|
|
|
44
47
|
render(<VisitDetailComponent {...defaultProps} />);
|
|
45
48
|
|
|
46
|
-
expect(screen.
|
|
47
|
-
expect(screen.
|
|
48
|
-
expect(screen.getByText(
|
|
49
|
-
expect(screen.
|
|
49
|
+
expect(screen.getByRole('heading', { name: /some visit type/i })).toBeInTheDocument();
|
|
50
|
+
expect(screen.getByRole('heading', { name: /no encounters found/i })).toBeInTheDocument();
|
|
51
|
+
expect(screen.getByText(/there is no information to display here/i)).toBeInTheDocument();
|
|
52
|
+
expect(screen.getByRole('tab', { name: /all encounters/i })).toBeInTheDocument();
|
|
53
|
+
expect(screen.getByRole('tab', { name: /visit summary/i })).toBeInTheDocument();
|
|
50
54
|
});
|
|
51
55
|
|
|
52
|
-
it('
|
|
56
|
+
it('renders the Encounter Lists view when the "All Encounters" tab is clicked', async () => {
|
|
53
57
|
const user = userEvent.setup();
|
|
54
58
|
|
|
55
59
|
mockUseVisit.mockReturnValue({
|
|
@@ -74,8 +78,12 @@ describe('VisitDetail', () => {
|
|
|
74
78
|
|
|
75
79
|
render(<VisitDetailComponent {...defaultProps} />);
|
|
76
80
|
|
|
77
|
-
await user.click(screen.
|
|
78
|
-
expect(screen.
|
|
81
|
+
await user.click(screen.getByRole('tab', { name: /all encounters/i }));
|
|
82
|
+
expect(screen.getByRole('table')).toBeInTheDocument();
|
|
83
|
+
expect(screen.getByRole('columnheader', { name: /time/i })).toBeInTheDocument();
|
|
84
|
+
expect(screen.getByRole('columnheader', { name: /encounter type/i })).toBeInTheDocument();
|
|
85
|
+
expect(screen.getByRole('columnheader', { name: /provider/i })).toBeInTheDocument();
|
|
86
|
+
expect(screen.getByRole('row', { name: /12:34 pm encounter type/i })).toBeInTheDocument();
|
|
79
87
|
});
|
|
80
88
|
|
|
81
89
|
it('renders the Visit Summaries view when the "Visit Summary" tab is clicked', async () => {
|
|
@@ -112,7 +120,12 @@ describe('VisitDetail', () => {
|
|
|
112
120
|
|
|
113
121
|
render(<VisitDetailComponent {...defaultProps} />);
|
|
114
122
|
|
|
115
|
-
await user.click(screen.
|
|
116
|
-
expect(screen.getByRole('tablist', { name:
|
|
123
|
+
await user.click(screen.getByRole('tab', { name: /visit summary/i }));
|
|
124
|
+
expect(screen.getByRole('tablist', { name: /visit summary tabs/i })).toBeInTheDocument();
|
|
125
|
+
expect(screen.getByRole('tab', { name: /notes/i })).toBeInTheDocument();
|
|
126
|
+
expect(screen.getByRole('tab', { name: /tests/i })).toBeInTheDocument();
|
|
127
|
+
expect(screen.getByRole('tab', { name: /medications/i })).toBeInTheDocument();
|
|
128
|
+
expect(screen.getByText(/no diagnoses found/i)).toBeInTheDocument();
|
|
129
|
+
expect(screen.getByText(/there are no notes to display for this patient/i)).toBeInTheDocument();
|
|
117
130
|
});
|
|
118
131
|
});
|