@pih/esm-pathology-app 1.0.7 → 1.1.1-pre.22

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.
Files changed (76) hide show
  1. package/.turbo/turbo-build.log +31 -0
  2. package/__mocks__/react-i18next.js +17 -16
  3. package/dist/39.js +2 -0
  4. package/dist/39.js.map +1 -0
  5. package/dist/574.js +1 -1
  6. package/dist/784.js +3 -0
  7. package/dist/{294.js.LICENSE.txt → 784.js.LICENSE.txt} +0 -0
  8. package/dist/784.js.map +1 -0
  9. package/dist/858.js +3 -0
  10. package/dist/858.js.LICENSE.txt +1 -0
  11. package/dist/858.js.map +1 -0
  12. package/dist/862.js +2 -0
  13. package/dist/862.js.map +1 -0
  14. package/dist/pih-esm-pathology-app.js +1 -2
  15. package/dist/pih-esm-pathology-app.js.buildmanifest.json +38 -98
  16. package/dist/pih-esm-pathology-app.js.map +1 -1
  17. package/dist/pih-esm-pathology-app.old +2 -0
  18. package/jest.config.json +2 -3
  19. package/package.json +10 -58
  20. package/src/Pathology-getter/Pathology-encounter-getter-resource.ts +15 -0
  21. package/src/Pathology-getter/Pathology-patient-encounters-getter-resource.ts +15 -0
  22. package/src/Pathology-getter/Pathology-patients-getter-resource.ts +12 -0
  23. package/src/config-schema.ts +22 -163
  24. package/src/declarations.d.tsx +1 -3
  25. package/src/pathology-report/ReportComponent.css +17 -39
  26. package/src/pathology-report/ReportComponent.tsx +38 -475
  27. package/src/pathology-report/TableRow.tsx +24 -0
  28. package/src/pathology.test.tsx +32 -0
  29. package/tsconfig.json +1 -19
  30. package/webpack.config.js +1 -30
  31. package/.babelrc +0 -10
  32. package/.eslintignore +0 -1
  33. package/.eslintrc +0 -5
  34. package/.gitattributes +0 -1
  35. package/.husky/pre-commit +0 -7
  36. package/.prettierignore +0 -2
  37. package/README.md +0 -4
  38. package/babel.config.json +0 -8
  39. package/dist/00ebb57bb20c59433e84.gif +0 -0
  40. package/dist/16.js +0 -3
  41. package/dist/16.js.LICENSE.txt +0 -1
  42. package/dist/16.js.map +0 -1
  43. package/dist/24.js +0 -3
  44. package/dist/24.js.LICENSE.txt +0 -16
  45. package/dist/24.js.map +0 -1
  46. package/dist/248.js +0 -3
  47. package/dist/248.js.LICENSE.txt +0 -99
  48. package/dist/248.js.map +0 -1
  49. package/dist/294.js +0 -3
  50. package/dist/294.js.map +0 -1
  51. package/dist/5b8bb278fcab4da4972e.ttf +0 -0
  52. package/dist/861.js +0 -2
  53. package/dist/861.js.map +0 -1
  54. package/dist/867.js +0 -2
  55. package/dist/867.js.map +0 -1
  56. package/dist/976.js +0 -3
  57. package/dist/976.js.LICENSE.txt +0 -8
  58. package/dist/976.js.map +0 -1
  59. package/dist/a5fad24f075c978ac04b.ttf +0 -0
  60. package/src/Fonts/georgia/GEORGIA4.TTF +0 -0
  61. package/src/Fonts/georgia/Georgia Bold Italic font.ttf +0 -0
  62. package/src/Fonts/georgia/Georgia Regular font.ttf +0 -0
  63. package/src/Fonts/georgia/Georgia.ttf +0 -0
  64. package/src/Fonts/georgia/georgia bold italic.ttf +0 -0
  65. package/src/Fonts/georgia/georgia italic.ttf +0 -0
  66. package/src/Fonts/georgia/georgia-bold.ttf +0 -0
  67. package/src/Fonts/georgia/georgiab.ttf +0 -0
  68. package/src/Fonts/georgia/georgiai.ttf +0 -0
  69. package/src/Fonts/georgia/georgiaz.ttf +0 -0
  70. package/src/Fonts/georgia/seriffic.ttf +0 -0
  71. package/src/Fonts/georgia/sharefonts.net.txt +0 -1
  72. package/src/Print-to-PDF/Document-Component.tsx +0 -296
  73. package/src/images/ButaroHospitalLogo.gif +0 -0
  74. package/src/pathology-report/ReportComponent.resource.ts +0 -279
  75. package/src/pathology-report/ReportComponent.test.tsx +0 -251
  76. package/src/test.html +0 -0
@@ -1,251 +0,0 @@
1
- import React from "react";
2
- import { render, screen, within, waitFor } from "@testing-library/react";
3
- import userEvent from "@testing-library/user-event";
4
- import {
5
- getUserLocation,
6
- getConceptAnswers,
7
- getLocations,
8
- getEncounters,
9
- } from "./ReportComponent.resource";
10
- import ReportComponent from "./ReportComponent";
11
- import { configSchema } from "../config-schema";
12
-
13
- jest.mock("./ReportComponent.resource");
14
- const mockedGetUserLocation = getUserLocation as jest.Mock;
15
- const mockedGetConceptAnswers = getConceptAnswers as jest.Mock;
16
- const mockedGetLocations = getLocations as jest.Mock;
17
- const mockedGetEncounters = getEncounters as jest.Mock;
18
-
19
- const encountersList = [
20
- {
21
- encounterDatetime: "2008-06-10T00:00:00.000+0200",
22
- resultsEncounterId: 2256122,
23
- middle_name: "",
24
- given_name: "Emille",
25
- encounterId: 75924,
26
- sampleDropoffObs: "YES",
27
- patientHealthCenter: "Rwinkwavu Health Center",
28
- referralStatusObs: "START DRUGS",
29
- patientPhoneNumber: null,
30
- patientUuid: "c610c8cc-2700-102b-80cb-0017a47871b2",
31
- personId: 13375,
32
- sampleStatusObs: "NO",
33
- encounterUuid: "f72c4cbb-8ae3-41e7-8011-2a41db1f4a69",
34
- family_name: "REBERO",
35
- referralStatusObsUuid: "d6c16e76-d7b3-41bc-add9-f24f3726d5f9",
36
- sampleStatusObsUuid: "40d10177-7de0-48b0-b414-51678e71a3de",
37
- sampleDropoffObsUuid: "0dd98a8f-f751-4bc6-a6bc-aaa605b411b1",
38
- },
39
- {
40
- encounterDatetime: "2008-06-20T00:00:00.000+0200",
41
- resultsEncounterId: null,
42
- middle_name: "",
43
- given_name: "Jacqueline",
44
- encounterId: 76624,
45
- sampleDropoffObs: null,
46
- patientHealthCenter: "Bukora Health Center",
47
- referralStatusObs: "CONTINUE REGIMEN",
48
- patientPhoneNumber: null,
49
- patientUuid: "b14bfa25-2b65-447c-9f0d-8fbb4aa3bf74",
50
- personId: 18292,
51
- sampleStatusObs: "UNKNOWN",
52
- encounterUuid: "36a25060-9c02-4d60-b1a1-53bd6ede1c7b",
53
- family_name: "MUKAMUSONERA",
54
- referralStatusObsUuid: "07012f07-c36d-4ae9-8468-f8d1f98b920c",
55
- sampleStatusObsUuid: "14487368-b57a-4829-ba7e-880b5c0bb8e0",
56
- sampleDropoffObsUuid: null,
57
- },
58
- {
59
- encounterDatetime: "2008-06-20T00:00:00.000+0200",
60
- resultsEncounterId: null,
61
- middle_name: "",
62
- given_name: "Evariste",
63
- encounterId: 76645,
64
- sampleDropoffObs: "YES",
65
- patientHealthCenter: "Bukora Health Center",
66
- referralStatusObs: "CONTINUE REGIMEN",
67
- patientPhoneNumber: null,
68
- patientUuid: "c610d1f0-2700-102b-80cb-0017a47871b2",
69
- personId: 13382,
70
- sampleStatusObs: "UNKNOWN",
71
- encounterUuid: "e26c7330-f5ce-40ae-83f9-8afe4d7f46fa",
72
- family_name: "NKOMEJE",
73
- referralStatusObsUuid: "840f0787-0b3b-4e9d-af31-fb68de4d61df",
74
- sampleStatusObsUuid: "2a86931b-6c9d-4138-9012-7dce39f7da43",
75
- sampleDropoffObsUuid: "a4b4fd30-abb9-41a7-8aff-d95ad2ead45f",
76
- },
77
- ];
78
-
79
- const locationList = [
80
- {
81
- uuid: "777984f1-fbee-4de7-aadf-39ac36a89680",
82
- display: "Bukora Health Center",
83
- },
84
- {
85
- uuid: "a62fd59a-6577-43e0-b39c-ba42ac8cfbc9",
86
- display: "Butaro Hospital",
87
- },
88
- {
89
- uuid: "885f137a-7ca4-4996-b111-4c76fe1ccb38",
90
- display: "Cyarubare Health Center",
91
- },
92
- ];
93
-
94
- const conceptList = [
95
- {
96
- uuid: "3ce163d8-26fe-102b-80cb-0017a47871b2",
97
- display: "UNKNOWN",
98
- },
99
- {
100
- uuid: "3ce163d8-26fe-102b-80cb-0017a47880cb",
101
- display: "NO",
102
- },
103
- {
104
- uuid: "3ce163d8-26fe-102b-80cb-0017a47880ce",
105
- display: "CONTINUE REGIMEN",
106
- },
107
- {
108
- uuid: "3ce163d8-26fe-102b-80cb-0017a47880cv",
109
- display: "START DRUGS",
110
- },
111
- ];
112
- describe("pathology request list", () => {
113
- beforeEach(() => {
114
- mockedGetEncounters.mockReset();
115
- mockedGetEncounters.mockReset();
116
- mockedGetUserLocation.mockReset();
117
- mockedGetEncounters.mockResolvedValue(encountersList);
118
- mockedGetLocations.mockResolvedValue(locationList);
119
- mockedGetConceptAnswers.mockResolvedValue(conceptList);
120
- mockedGetUserLocation.mockResolvedValue(
121
- "777984f1-fbee-4de7-aadf-39ac36a89680"
122
- );
123
-
124
- render(<ReportComponent />);
125
- });
126
-
127
- it("renders the expected fields", async () => {
128
- const row = await screen
129
- .getByText(
130
- new RegExp(
131
- encountersList[0].family_name +
132
- "\\s*" +
133
- encountersList[0].given_name +
134
- "\\s*" +
135
- encountersList[0].middle_name
136
- )
137
- )
138
- .closest("tr");
139
- within(row).getByText(encountersList[0].patientHealthCenter);
140
- within(row).getByText(encountersList[0].encounterDatetime);
141
- within(row).getByText(
142
- encountersList[0].resultsEncounterId ? "Results" : "Fill in results"
143
- );
144
- if (encountersList[0].sampleStatusObs) {
145
- within(row).getByDisplayValue(encountersList[0].sampleStatusObs);
146
- }
147
- if (encountersList[0].referralStatusObs) {
148
- within(row).getByDisplayValue(encountersList[0].referralStatusObs);
149
- }
150
- // if(encountersList[0].sampleDropoffObs){
151
- // expect( within(row).getByTestId("sampleDropOff")).toHaveAttribute('checked',true);
152
- // }
153
- });
154
- it("navigates to the links", async () => {
155
- const table = await screen.getByRole("table");
156
- const patientDashLink = within(table).getByText(
157
- new RegExp(
158
- encountersList[0].family_name +
159
- "\\s*" +
160
- encountersList[0].given_name +
161
- "\\s*" +
162
- encountersList[0].middle_name
163
- )
164
- );
165
- userEvent.click(patientDashLink);
166
- await waitFor(() => {
167
- expect(patientDashLink.closest("a")).toHaveAttribute(
168
- "href",
169
- "/openmrs/patientDashboard.form?patientId=" + encountersList[0].personId
170
- );
171
- });
172
- const resultsFormLink = within(table).getByTestId("resultsEncounter");
173
- userEvent.click(resultsFormLink);
174
- await waitFor(() => {
175
- expect(resultsFormLink.closest("a")).toHaveAttribute(
176
- "href",
177
- encountersList[0].resultsEncounterId
178
- ? `/openmrs/module/htmlformentry/htmlFormEntry.form?encounterId=${encountersList[0].resultsEncounterId}&mode=VIEW`
179
- : `/openmrs/module/htmlformentry/htmlFormEntry.form?personId=${encountersList[0].personId}&patientId=${encountersList[0].personId}&returnUrl=&formId=${configSchema.pathologyResultsFromID._default}&uuid=${encountersList[0].encounterUuid}`
180
- );
181
- });
182
- });
183
-
184
- it("filters by sending hospital", () => {
185
- const dropdown = screen.getByLabelText("Sending Hospital", {
186
- selector: "select",
187
- });
188
- userEvent.selectOptions(dropdown, "Bukora Health Center");
189
- expect(screen.queryByText("REBERO Emille")).not.toBeInTheDocument();
190
- expect(screen.queryByText("MUKAMUSONERA Jacqueline")).toBeInTheDocument();
191
- expect(screen.queryByText("NKOMEJE Evariste")).toBeInTheDocument();
192
- });
193
-
194
- it("filters by sample status", () => {
195
- const dropdown = screen.getByLabelText("Sample Status", {
196
- selector: "select",
197
- });
198
- userEvent.selectOptions(dropdown, "UNKNOWN");
199
- expect(screen.queryByText("REBERO Emille")).not.toBeInTheDocument();
200
- expect(screen.queryByText("MUKAMUSONERA Jacqueline")).toBeInTheDocument();
201
- expect(screen.queryByText("NKOMEJE Evariste")).toBeInTheDocument();
202
- });
203
-
204
- it("filters by referral status", () => {
205
- const dropdown = screen.getByLabelText("Referral Status", {
206
- selector: "select",
207
- });
208
- userEvent.selectOptions(dropdown, "CONTINUE REGIMEN");
209
- expect(screen.queryByText("REBERO Emille")).not.toBeInTheDocument();
210
- expect(screen.queryByText("MUKAMUSONERA Jacqueline")).toBeInTheDocument();
211
- expect(screen.queryByText("NKOMEJE Evariste")).toBeInTheDocument();
212
- });
213
-
214
- it("filters by patient name", async () => {
215
- const textBox = screen.getByLabelText("Patient Name") as HTMLInputElement;
216
- userEvent.type(textBox, "NKOMEJE");
217
- expect(screen.queryByText("REBERO Emille")).not.toBeInTheDocument();
218
- expect(
219
- screen.queryByText("MUKAMUSONERA Jacqueline")
220
- ).not.toBeInTheDocument();
221
- expect(screen.queryByText("NKOMEJE Evariste")).toBeInTheDocument();
222
-
223
- textBox.setSelectionRange(0, textBox.value.length); // clear input
224
- userEvent.type(textBox, "jac muk");
225
- expect(textBox.value).toBe("jac muk"); // sanity check
226
- expect(screen.queryByText("REBERO Emille")).not.toBeInTheDocument();
227
- expect(screen.queryByText("MUKAMUSONERA Jacqueline")).toBeInTheDocument();
228
- expect(screen.queryByText("NKOMEJE Evariste")).not.toBeInTheDocument();
229
- });
230
-
231
- it("infers list of sending hospital", async () => {
232
- const dropdown = screen.getByLabelText("Sending Hospital", {
233
- selector: "select",
234
- });
235
- userEvent.selectOptions(dropdown, "Bukora Health Center");
236
- });
237
-
238
- it("infers list of sample status", () => {
239
- const dropdown = screen.getByLabelText("Sample Status", {
240
- selector: "select",
241
- });
242
- userEvent.selectOptions(dropdown, "UNKNOWN");
243
- });
244
-
245
- it("infers list of Referral status", () => {
246
- const dropdown = screen.getByLabelText("Referral Status", {
247
- selector: "select",
248
- });
249
- userEvent.selectOptions(dropdown, "CONTINUE REGIMEN");
250
- });
251
- });
package/src/test.html DELETED
File without changes