@openmrs/esm-appointments-app 10.0.3-pre.8521 → 10.0.3-pre.8526

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.
@@ -5,4 +5,4 @@
5
5
  │ 6973.js (315.022 KiB)
6
6
  
7
7
 
8
- Rspack compiled with 1 warning in 27.07 s
8
+ Rspack compiled with 1 warning in 21.63 s
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0","appointments":">=2.0.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"},"order":2},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-dashboard","slot":"appointments-dashboard-slot","component":"appointmentsDashboard"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"early-appointments-panel","component":"earlyAppointments"},{"name":"patient-appointments-summary-dashboard","component":"patientAppointmentsSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"hideDashboardTitle":true,"path":"appointments","slot":"patient-chart-appointments-dashboard-slot","title":"Appointments"}},{"name":"appointments-details-widget","component":"patientAppointmentsDetailedSummary","slot":"patient-chart-appointments-dashboard-slot","meta":{"columnSpan":1}},{"name":"patient-upcoming-appointment-widget","component":"patientUpcomingAppointmentsWidget","slot":"visit-form-top-slot"},{"name":"home-appointments-tile","slot":"home-metrics-tiles-slot","component":"homeAppointmentsTile"},{"name":"metrics-card-scheduled-appointments","component":"metricsCardScheduledAppointments","slot":"appointments-metrics-slot","order":1},{"name":"metrics-card-highest-volume-service","component":"metricsCardHighestVolumeService","slot":"appointments-metrics-slot","order":2},{"name":"metrics-card-providers-booked","component":"metricsCardProvidersBooked","slot":"appointments-metrics-slot","order":3}],"modals":[{"name":"end-appointment-modal","component":"endAppointmentModal"},{"name":"cancel-appointment-modal","component":"cancelAppointmentModal"},{"name":"batch-change-appointments-statuses-modal","component":"batchChangeAppointmentStatusesModal"}],"workspaceGroups2":[{"name":"appointments-group","scopePattern":"/home/appointments"}],"workspaceWindows2":[{"name":"appointments-window","group":"appointments-group"}],"workspaces2":[{"name":"appointments-form-workspace","component":"appointmentsFormWorkspace","window":"appointments-window"},{"name":"appointments-patient-search-workspace","component":"@openmrs/esm-patient-search-app#patientSearchWorkspace2","window":"appointments-window"},{"name":"appointments-start-visit-workspace","component":"@openmrs/esm-patient-chart-app#exportedVisitForm","window":"appointments-window"}],"version":"10.0.3-pre.8521"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0","appointments":">=2.0.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"},"order":2},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-dashboard","slot":"appointments-dashboard-slot","component":"appointmentsDashboard"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"early-appointments-panel","component":"earlyAppointments"},{"name":"patient-appointments-summary-dashboard","component":"patientAppointmentsSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"hideDashboardTitle":true,"path":"appointments","slot":"patient-chart-appointments-dashboard-slot","title":"Appointments"}},{"name":"appointments-details-widget","component":"patientAppointmentsDetailedSummary","slot":"patient-chart-appointments-dashboard-slot","meta":{"columnSpan":1}},{"name":"patient-upcoming-appointment-widget","component":"patientUpcomingAppointmentsWidget","slot":"visit-form-top-slot"},{"name":"home-appointments-tile","slot":"home-metrics-tiles-slot","component":"homeAppointmentsTile"},{"name":"metrics-card-scheduled-appointments","component":"metricsCardScheduledAppointments","slot":"appointments-metrics-slot","order":1},{"name":"metrics-card-highest-volume-service","component":"metricsCardHighestVolumeService","slot":"appointments-metrics-slot","order":2},{"name":"metrics-card-providers-booked","component":"metricsCardProvidersBooked","slot":"appointments-metrics-slot","order":3}],"modals":[{"name":"end-appointment-modal","component":"endAppointmentModal"},{"name":"cancel-appointment-modal","component":"cancelAppointmentModal"},{"name":"batch-change-appointments-statuses-modal","component":"batchChangeAppointmentStatusesModal"}],"workspaceGroups2":[{"name":"appointments-group","scopePattern":"/home/appointments"}],"workspaceWindows2":[{"name":"appointments-window","group":"appointments-group"}],"workspaces2":[{"name":"appointments-form-workspace","component":"appointmentsFormWorkspace","window":"appointments-window"},{"name":"appointments-patient-search-workspace","component":"@openmrs/esm-patient-search-app#patientSearchWorkspace2","window":"appointments-window"},{"name":"appointments-start-visit-workspace","component":"@openmrs/esm-patient-chart-app#exportedVisitForm","window":"appointments-window"}],"version":"10.0.3-pre.8526"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-appointments-app",
3
- "version": "10.0.3-pre.8521",
3
+ "version": "10.0.3-pre.8526",
4
4
  "description": "Appointments front-end module for O3",
5
5
  "browser": "dist/openmrs-esm-appointments-app.js",
6
6
  "main": "src/index.ts",
@@ -0,0 +1,233 @@
1
+ import { convertTime12to24 } from '../time';
2
+
3
+ describe('convertTime12to24', () => {
4
+ describe('AM conversion', () => {
5
+ it('should convert 12:00 AM to 00:00', () => {
6
+ const result = convertTime12to24('12:00', 'AM');
7
+ expect(result).toEqual(['00', '00']);
8
+ });
9
+
10
+ it('should convert 12:30 AM to 00:30', () => {
11
+ const result = convertTime12to24('12:30', 'AM');
12
+ expect(result).toEqual(['00', '30']);
13
+ });
14
+
15
+ it('should convert 1:00 AM to 1:00', () => {
16
+ const result = convertTime12to24('1:00', 'AM');
17
+ expect(result).toEqual(['1', '00']);
18
+ });
19
+
20
+ it('should convert 1:15 AM to 1:15', () => {
21
+ const result = convertTime12to24('1:15', 'AM');
22
+ expect(result).toEqual(['1', '15']);
23
+ });
24
+
25
+ it('should convert 11:59 AM to 11:59', () => {
26
+ const result = convertTime12to24('11:59', 'AM');
27
+ expect(result).toEqual(['11', '59']);
28
+ });
29
+
30
+ it('should convert 6:45 AM to 6:45', () => {
31
+ const result = convertTime12to24('6:45', 'AM');
32
+ expect(result).toEqual(['6', '45']);
33
+ });
34
+
35
+ it('should handle single digit hour in AM', () => {
36
+ const result = convertTime12to24('9:00', 'AM');
37
+ expect(result).toEqual(['9', '00']);
38
+ });
39
+
40
+ it('should handle single digit minute in AM', () => {
41
+ const result = convertTime12to24('10:5', 'AM');
42
+ expect(result).toEqual(['10', '5']);
43
+ });
44
+ });
45
+
46
+ describe('PM conversion', () => {
47
+ it('should convert 12:00 PM to 12:00', () => {
48
+ const result = convertTime12to24('12:00', 'PM');
49
+ expect(result).toEqual(['12', '00']);
50
+ });
51
+
52
+ it('should convert 12:30 PM to 12:30', () => {
53
+ const result = convertTime12to24('12:30', 'PM');
54
+ expect(result).toEqual(['12', '30']);
55
+ });
56
+
57
+ it('should convert 1:00 PM to 13:00', () => {
58
+ const result = convertTime12to24('1:00', 'PM');
59
+ expect(result).toEqual([13, '00']);
60
+ });
61
+
62
+ it('should convert 1:15 PM to 13:15', () => {
63
+ const result = convertTime12to24('1:15', 'PM');
64
+ expect(result).toEqual([13, '15']);
65
+ });
66
+
67
+ it('should convert 11:59 PM to 23:59', () => {
68
+ const result = convertTime12to24('11:59', 'PM');
69
+ expect(result).toEqual([23, '59']);
70
+ });
71
+
72
+ it('should convert 6:30 PM to 18:30', () => {
73
+ const result = convertTime12to24('6:30', 'PM');
74
+ expect(result).toEqual([18, '30']);
75
+ });
76
+
77
+ it('should convert 2:45 PM to 14:45', () => {
78
+ const result = convertTime12to24('2:45', 'PM');
79
+ expect(result).toEqual([14, '45']);
80
+ });
81
+
82
+ it('should convert 10:00 PM to 22:00', () => {
83
+ const result = convertTime12to24('10:00', 'PM');
84
+ expect(result).toEqual([22, '00']);
85
+ });
86
+
87
+ it('should handle single digit hour in PM', () => {
88
+ const result = convertTime12to24('9:00', 'PM');
89
+ expect(result).toEqual([21, '00']);
90
+ });
91
+
92
+ it('should handle single digit minute in PM', () => {
93
+ const result = convertTime12to24('3:5', 'PM');
94
+ expect(result).toEqual([15, '5']);
95
+ });
96
+ });
97
+
98
+ describe('edge cases', () => {
99
+ it('should handle 00:00 AM (midnight)', () => {
100
+ const result = convertTime12to24('00:00', 'AM');
101
+ expect(result).toEqual(['00', '00']);
102
+ });
103
+
104
+ it('should handle 12:59 AM (last minute before 1 AM)', () => {
105
+ const result = convertTime12to24('12:59', 'AM');
106
+ expect(result).toEqual(['00', '59']);
107
+ });
108
+
109
+ it('should handle 12:00 PM (noon)', () => {
110
+ const result = convertTime12to24('12:00', 'PM');
111
+ expect(result).toEqual(['12', '00']);
112
+ });
113
+
114
+ it('should handle 12:59 PM (last minute before midnight)', () => {
115
+ const result = convertTime12to24('12:59', 'PM');
116
+ expect(result).toEqual(['12', '59']);
117
+ });
118
+
119
+ it('should convert all valid PM hours (1-11)', () => {
120
+ const expectedResults = [
121
+ [13, '00'], // 1 PM
122
+ [14, '00'], // 2 PM
123
+ [15, '00'], // 3 PM
124
+ [16, '00'], // 4 PM
125
+ [17, '00'], // 5 PM
126
+ [18, '00'], // 6 PM
127
+ [19, '00'], // 7 PM
128
+ [20, '00'], // 8 PM
129
+ [21, '00'], // 9 PM
130
+ [22, '00'], // 10 PM
131
+ [23, '00'], // 11 PM
132
+ ];
133
+
134
+ for (let i = 1; i <= 11; i++) {
135
+ const result = convertTime12to24(`${i}:00`, 'PM');
136
+ expect(result).toEqual(expectedResults[i - 1]);
137
+ }
138
+ });
139
+
140
+ it('should convert all valid AM hours (1-11)', () => {
141
+ const expectedResults = [
142
+ ['1', '00'], // 1 AM
143
+ ['2', '00'], // 2 AM
144
+ ['3', '00'], // 3 AM
145
+ ['4', '00'], // 4 AM
146
+ ['5', '00'], // 5 AM
147
+ ['6', '00'], // 6 AM
148
+ ['7', '00'], // 7 AM
149
+ ['8', '00'], // 8 AM
150
+ ['9', '00'], // 9 AM
151
+ ['10', '00'], // 10 AM
152
+ ['11', '00'], // 11 AM
153
+ ];
154
+
155
+ for (let i = 1; i <= 11; i++) {
156
+ const result = convertTime12to24(`${i}:00`, 'AM');
157
+ expect(result).toEqual(expectedResults[i - 1]);
158
+ }
159
+ });
160
+ });
161
+
162
+ describe('invalid/malformed input', () => {
163
+ it('should handle time with no colon separator', () => {
164
+ const result = convertTime12to24('1200', 'AM');
165
+ expect(result).toEqual(['1200', undefined]);
166
+ });
167
+
168
+ it('should handle time with only hour part', () => {
169
+ const result = convertTime12to24('10', 'AM');
170
+ expect(result).toEqual(['10', undefined]);
171
+ });
172
+
173
+ it('should handle empty string', () => {
174
+ const result = convertTime12to24('', 'AM');
175
+ expect(result).toEqual(['', undefined]);
176
+ });
177
+
178
+ it('should handle multiple colons in time string', () => {
179
+ const result = convertTime12to24('10:30:45', 'AM');
180
+ expect(result).toEqual(['10', '30']);
181
+ });
182
+
183
+ it('should handle non-numeric hours', () => {
184
+ const result = convertTime12to24('abc:00', 'AM');
185
+ // Should attempt to parse but result in NaN when converted to integer
186
+ expect(result[0]).toBe('abc');
187
+ expect(result[1]).toBe('00');
188
+ });
189
+
190
+ it('should handle leading zeros in minutes', () => {
191
+ const result = convertTime12to24('1:05', 'AM');
192
+ expect(result).toEqual(['1', '05']);
193
+ });
194
+
195
+ it('should handle whitespace in time string', () => {
196
+ const result = convertTime12to24('10 : 30', 'AM');
197
+ expect(result).toEqual(['10 ', ' 30']);
198
+ });
199
+ });
200
+
201
+ describe('return value structure', () => {
202
+ it('should always return an array of exactly 2 elements', () => {
203
+ const result = convertTime12to24('10:30', 'AM');
204
+ expect(Array.isArray(result)).toBe(true);
205
+ expect(result.length).toBe(2);
206
+ });
207
+
208
+ it('should return first element as hours and second as minutes', () => {
209
+ const result = convertTime12to24('3:45', 'AM');
210
+ expect(result[0]).toBeDefined();
211
+ expect(result[1]).toBeDefined();
212
+ });
213
+
214
+ it('should preserve minute part exactly as provided', () => {
215
+ const result = convertTime12to24('5:59', 'AM');
216
+ expect(result[1]).toBe('59');
217
+ });
218
+
219
+ it('should return hour as number after PM conversion (except for 12 PM)', () => {
220
+ const result1 = convertTime12to24('5:00', 'PM');
221
+ expect(typeof result1[0]).toBe('number');
222
+
223
+ const result2 = convertTime12to24('12:00', 'PM');
224
+ // 12 PM returns the string '12', not a number
225
+ expect(result2[0]).toBe('12');
226
+ });
227
+
228
+ it('should return hour as string for AM times and non-12 values', () => {
229
+ const result = convertTime12to24('5:00', 'AM');
230
+ expect(typeof result[0]).toBe('string');
231
+ });
232
+ });
233
+ });