@pih/esm-referrals-queue-app 2.0.0-pre.17 → 2.1.1-pre.10

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 (257) hide show
  1. package/.turbo/turbo-build.log +37 -0
  2. package/README.md +1 -17
  3. package/dist/150.js +1 -0
  4. package/dist/150.js.map +1 -0
  5. package/dist/173.js +1 -0
  6. package/dist/173.js.map +1 -0
  7. package/dist/291.js +1 -0
  8. package/dist/291.js.map +1 -0
  9. package/dist/{574.js → 300.js} +1 -1
  10. package/dist/41.js +2 -0
  11. package/dist/41.js.map +1 -0
  12. package/dist/449.js +1 -0
  13. package/dist/449.js.map +1 -0
  14. package/dist/55.js +1 -0
  15. package/dist/830.js +1 -0
  16. package/dist/830.js.map +1 -0
  17. package/dist/831.js +2 -0
  18. package/dist/831.js.map +1 -0
  19. package/dist/871.js +2 -0
  20. package/dist/871.js.LICENSE.txt +39 -0
  21. package/dist/871.js.map +1 -0
  22. package/dist/913.js +2 -0
  23. package/dist/913.js.LICENSE.txt +52 -0
  24. package/dist/913.js.map +1 -0
  25. package/dist/99.js +1 -0
  26. package/dist/main.js +1 -1
  27. package/dist/main.js.map +1 -1
  28. package/dist/pih-esm-referrals-queue-app.js +1 -1
  29. package/dist/pih-esm-referrals-queue-app.js.buildmanifest.json +135 -275
  30. package/dist/pih-esm-referrals-queue-app.js.map +1 -1
  31. package/dist/routes.json +1 -1
  32. package/jest.config.js +3 -0
  33. package/package.json +27 -69
  34. package/src/config-schema.ts +8 -16
  35. package/src/declarations.d.tsx +3 -8
  36. package/src/index.ts +7 -19
  37. package/src/referrals-queue/referrals-queue.component.tsx +36 -70
  38. package/src/referrals-queue/referrals-queue.resource.tsx +6 -9
  39. package/src/referrals-queue/referrals-queue.scss +1 -4
  40. package/src/referrals-queue/referrals-queue.test.tsx +129 -122
  41. package/src/root.component.test.tsx +3 -3
  42. package/src/root.component.tsx +5 -5
  43. package/src/setup-tests.ts +8 -8
  44. package/src/table/referrals-table.component.tsx +12 -31
  45. package/src/util.ts +5 -9
  46. package/tsconfig.json +4 -22
  47. package/.editorconfig +0 -12
  48. package/.eslintignore +0 -2
  49. package/.eslintrc +0 -4
  50. package/.github/workflows/node.js.yml +0 -79
  51. package/.husky/pre-push +0 -7
  52. package/.prettierignore +0 -14
  53. package/LICENSE +0 -401
  54. package/dist/023bd53d342b7463.woff +0 -0
  55. package/dist/02acc4469a2fe2e4.woff2 +0 -0
  56. package/dist/033e03f8663ab9b1.woff +0 -0
  57. package/dist/052607e67da262ec.woff +0 -0
  58. package/dist/081587ca0db8e63f.woff2 +0 -0
  59. package/dist/08cf53c4e5e71cf1.woff2 +0 -0
  60. package/dist/090b2bc014d24ea4.woff2 +0 -0
  61. package/dist/0a28cd0b47497b71.woff +0 -0
  62. package/dist/0a9765a89ff0437d.woff +0 -0
  63. package/dist/0ae92bcea615e948.woff2 +0 -0
  64. package/dist/0be8520d8945b3b7.woff2 +0 -0
  65. package/dist/0bf6b66a8b86b014.woff +0 -0
  66. package/dist/0e7dd073cd8bb0ad.woff2 +0 -0
  67. package/dist/14869ac5d1830304.woff2 +0 -0
  68. package/dist/14aaceff85fc8b28.woff2 +0 -0
  69. package/dist/153.js +0 -1
  70. package/dist/153.js.map +0 -1
  71. package/dist/1590052e1cf8f28d.woff +0 -0
  72. package/dist/16f443eed01776ca.woff2 +0 -0
  73. package/dist/183bae0e53a22182.woff2 +0 -0
  74. package/dist/19b239a0bb74b27e.woff +0 -0
  75. package/dist/19c8f94ccd6289f5.woff2 +0 -0
  76. package/dist/1ae86565eab7451c.woff2 +0 -0
  77. package/dist/1c7bf8797e0a9be6.woff2 +0 -0
  78. package/dist/1d9aff9a93a3bb66.woff +0 -0
  79. package/dist/1f266d3619b30f16.woff2 +0 -0
  80. package/dist/1f8c5a4087a524fd.woff2 +0 -0
  81. package/dist/20ba2b23c5c0cd0b.woff2 +0 -0
  82. package/dist/2269d45733c5cf8f.woff +0 -0
  83. package/dist/258ecbd235953099.woff +0 -0
  84. package/dist/294.js +0 -2
  85. package/dist/294.js.map +0 -1
  86. package/dist/295dd01a1fbfee6d.woff2 +0 -0
  87. package/dist/2d7f835ab7c7c764.woff +0 -0
  88. package/dist/2f66cca99eeead63.woff +0 -0
  89. package/dist/2f686985e26e7107.woff2 +0 -0
  90. package/dist/315eff729e4ccbd9.woff2 +0 -0
  91. package/dist/319.js +0 -1
  92. package/dist/32f1e5aadf845e08.woff +0 -0
  93. package/dist/338484e1c850669c.woff +0 -0
  94. package/dist/33b7a82f1e295190.woff +0 -0
  95. package/dist/3674d98ec4a9173d.woff +0 -0
  96. package/dist/368d16e3259bf207.woff2 +0 -0
  97. package/dist/36c49aa341a7079a.woff2 +0 -0
  98. package/dist/36e1e0430475edee.woff2 +0 -0
  99. package/dist/3bc19662b8630ee9.woff2 +0 -0
  100. package/dist/3f645f473b3f8fba.woff2 +0 -0
  101. package/dist/4095df88acae9e98.woff +0 -0
  102. package/dist/4218ac9901b9d36d.woff2 +0 -0
  103. package/dist/468.js +0 -2
  104. package/dist/468.js.LICENSE.txt +0 -47
  105. package/dist/468.js.map +0 -1
  106. package/dist/4680ba68412e4da9.woff2 +0 -0
  107. package/dist/47d7a8698d562a0e.woff +0 -0
  108. package/dist/47ec6c9dffe776a0.woff +0 -0
  109. package/dist/48e37bd7ebf85a1f.woff2 +0 -0
  110. package/dist/48edfdf51dfb3160.woff +0 -0
  111. package/dist/4a35a2746c8ad7a5.woff +0 -0
  112. package/dist/4e11b8a7c445255f.woff2 +0 -0
  113. package/dist/4ea1f5c3baf89fe3.woff +0 -0
  114. package/dist/4ea99f41c896bf9d.woff +0 -0
  115. package/dist/5005db1d1caf70c7.woff +0 -0
  116. package/dist/512.js +0 -2
  117. package/dist/512.js.LICENSE.txt +0 -18
  118. package/dist/512.js.map +0 -1
  119. package/dist/528a8e7c1c141a31.woff +0 -0
  120. package/dist/52ca12f5b516d4ea.woff +0 -0
  121. package/dist/537ddd61c5c1fce2.woff2 +0 -0
  122. package/dist/5432f7541ec25c34.woff +0 -0
  123. package/dist/54a95d73a9454ba3.woff +0 -0
  124. package/dist/559.js +0 -1
  125. package/dist/559.js.map +0 -1
  126. package/dist/56c4118c0907f151.woff2 +0 -0
  127. package/dist/5938bc2ae7ec60c0.woff2 +0 -0
  128. package/dist/594306657c4e44e8.woff +0 -0
  129. package/dist/5a538aa477a66067.woff +0 -0
  130. package/dist/5c6586155f0d278a.woff2 +0 -0
  131. package/dist/60ec587649ba812a.woff2 +0 -0
  132. package/dist/616567cd947eb9dd.woff +0 -0
  133. package/dist/65168b59f44caab4.woff +0 -0
  134. package/dist/65c0982f98374864.woff +0 -0
  135. package/dist/65e6511e035870e1.woff2 +0 -0
  136. package/dist/661425f6798cd16a.woff2 +0 -0
  137. package/dist/66b864fe213caf46.woff2 +0 -0
  138. package/dist/6775fee945132ef9.woff +0 -0
  139. package/dist/68bbd362c8e4983b.woff +0 -0
  140. package/dist/68d6deec87b6b604.woff +0 -0
  141. package/dist/69a7e6d31d390296.woff +0 -0
  142. package/dist/69d087d970ee9455.woff2 +0 -0
  143. package/dist/69fa3fc7363bbc04.woff +0 -0
  144. package/dist/6a1f0178b45b2e9e.woff +0 -0
  145. package/dist/6c6c45e66ff54281.woff2 +0 -0
  146. package/dist/6ffb9ed97b21fdc0.woff +0 -0
  147. package/dist/7073a7323e92bd11.woff2 +0 -0
  148. package/dist/718c6cc31274ab1a.woff2 +0 -0
  149. package/dist/72cdbedfe04be9f9.woff2 +0 -0
  150. package/dist/7509c9f56fe9e532.woff2 +0 -0
  151. package/dist/757.js +0 -1
  152. package/dist/75dc5c5b04adc8bf.woff2 +0 -0
  153. package/dist/76a7c256fc8b3490.woff +0 -0
  154. package/dist/77b48bc05299ecca.woff2 +0 -0
  155. package/dist/783.js +0 -1
  156. package/dist/783.js.map +0 -1
  157. package/dist/787f56efa306ddbc.woff +0 -0
  158. package/dist/7a0a0215c248c73d.woff2 +0 -0
  159. package/dist/7c4463d9c84f263a.woff +0 -0
  160. package/dist/7d112a556b7670d2.woff +0 -0
  161. package/dist/7d52d6014b5f2bbc.woff +0 -0
  162. package/dist/7f00bebb24e40167.woff2 +0 -0
  163. package/dist/7f2c6ea3e740417e.woff +0 -0
  164. package/dist/800.js +0 -2
  165. package/dist/800.js.map +0 -1
  166. package/dist/802c6176541eeed7.woff2 +0 -0
  167. package/dist/8080081b3379c637.woff2 +0 -0
  168. package/dist/8274cc1afc7619f1.woff +0 -0
  169. package/dist/8605507b7a8487c4.woff2 +0 -0
  170. package/dist/897.js +0 -2
  171. package/dist/897.js.LICENSE.txt +0 -21
  172. package/dist/897.js.map +0 -1
  173. package/dist/8a83d654702f6534.woff2 +0 -0
  174. package/dist/8ccee65f6cf254ee.woff +0 -0
  175. package/dist/8d82a082a4aba439.woff +0 -0
  176. package/dist/8de04ae985937b56.woff +0 -0
  177. package/dist/8fe71173a13fe571.woff2 +0 -0
  178. package/dist/90edccb224a51cee.woff +0 -0
  179. package/dist/94b292fe87831a8b.woff +0 -0
  180. package/dist/95dc66c1b88745f8.woff +0 -0
  181. package/dist/95fb698be77c85ef.woff +0 -0
  182. package/dist/9624cec0f9bdd81e.woff2 +0 -0
  183. package/dist/9662331fa31e3f20.woff +0 -0
  184. package/dist/98a3af55a1698171.woff2 +0 -0
  185. package/dist/9ba85996af74c5ce.woff2 +0 -0
  186. package/dist/9bc133b1df25cb74.woff +0 -0
  187. package/dist/9ddb22faa35006e7.woff2 +0 -0
  188. package/dist/9e97352380611b95.woff +0 -0
  189. package/dist/a167fb2799dd741b.woff2 +0 -0
  190. package/dist/a2045a5cc4fdf94f.woff2 +0 -0
  191. package/dist/a246c73905a31c93.woff2 +0 -0
  192. package/dist/a401aa7939cb6e6f.woff2 +0 -0
  193. package/dist/a41a71258c38684d.woff +0 -0
  194. package/dist/a60d94a72d615a8e.woff +0 -0
  195. package/dist/a66764dd0c1fa213.woff +0 -0
  196. package/dist/a6ed036f17a1ea29.woff2 +0 -0
  197. package/dist/a8f635129d660202.woff +0 -0
  198. package/dist/a9f25ca430709a1a.woff2 +0 -0
  199. package/dist/ae14d98ad8a1212c.woff +0 -0
  200. package/dist/aeec4f78084adf7f.woff +0 -0
  201. package/dist/af11e94b0644eba5.woff +0 -0
  202. package/dist/afa9121a49e95351.woff2 +0 -0
  203. package/dist/afcda12d9f805543.woff2 +0 -0
  204. package/dist/b09ded85a7da77f1.woff2 +0 -0
  205. package/dist/b2f4e9d1e821b71c.woff2 +0 -0
  206. package/dist/b30b06698dc369b2.woff +0 -0
  207. package/dist/b4a074bf828bb757.woff2 +0 -0
  208. package/dist/b7f447da43f6e596.woff2 +0 -0
  209. package/dist/b7f633b871b84820.woff +0 -0
  210. package/dist/bcca84a524572d10.woff2 +0 -0
  211. package/dist/be4d1f97b11d087c.woff2 +0 -0
  212. package/dist/be91def2232f6776.woff +0 -0
  213. package/dist/bec14780d81164de.woff2 +0 -0
  214. package/dist/c285f4b15d11f172.woff +0 -0
  215. package/dist/c4673617b80801f3.woff +0 -0
  216. package/dist/c553f7e0199c5084.woff2 +0 -0
  217. package/dist/c8470ed2c145ace7.woff +0 -0
  218. package/dist/c9d9ce9f465df4fe.woff2 +0 -0
  219. package/dist/ccb2870475da9fe8.woff +0 -0
  220. package/dist/d04134fa33c2606d.woff +0 -0
  221. package/dist/d11f9c5cd7d9ea16.woff +0 -0
  222. package/dist/d188f7f036ac5779.woff2 +0 -0
  223. package/dist/d265d81c58525ae4.woff2 +0 -0
  224. package/dist/d5942cd81663e136.woff2 +0 -0
  225. package/dist/d6097a5c452acf6d.woff +0 -0
  226. package/dist/d66b8ff73d95cabb.woff2 +0 -0
  227. package/dist/d77f5bf95de8edaa.woff +0 -0
  228. package/dist/d8829a685af4f372.woff +0 -0
  229. package/dist/d88899ef0fd16719.woff2 +0 -0
  230. package/dist/d9a5d958e69e058d.woff2 +0 -0
  231. package/dist/da65d9a514c628c8.woff +0 -0
  232. package/dist/dac90d495be353a0.woff2 +0 -0
  233. package/dist/dd7071bc6306585c.woff +0 -0
  234. package/dist/dd8ce598529c3fab.woff2 +0 -0
  235. package/dist/ddef6f2dd566c2b9.woff +0 -0
  236. package/dist/de013f1be25103fa.woff2 +0 -0
  237. package/dist/dee2ff599db31e5b.woff +0 -0
  238. package/dist/dee7c6b5dd954d9b.woff +0 -0
  239. package/dist/df222fceeffca849.woff2 +0 -0
  240. package/dist/e0d2e5b12f028b5d.woff +0 -0
  241. package/dist/e33e3db8e4f7559f.woff +0 -0
  242. package/dist/e62b00b9199c1ac9.woff2 +0 -0
  243. package/dist/e696cef1407b2610.woff2 +0 -0
  244. package/dist/e89ca83b24959664.woff +0 -0
  245. package/dist/eb8c0ae77ad55249.woff +0 -0
  246. package/dist/ed0997bd7d221b8e.woff +0 -0
  247. package/dist/eed48feba743e21c.woff2 +0 -0
  248. package/dist/f280bda8a6e535a6.woff +0 -0
  249. package/dist/f543c88feb236d11.woff2 +0 -0
  250. package/dist/f591b0079faa93fe.woff2 +0 -0
  251. package/dist/f6ed27923769ad1d.woff2 +0 -0
  252. package/dist/f8803bebe640d99a.woff +0 -0
  253. package/dist/fbebeb4336e67012.woff2 +0 -0
  254. package/dist/fd522cd7a5c646fe.woff +0 -0
  255. package/jest.config.json +0 -19
  256. /package/dist/{294.js.LICENSE.txt → 41.js.LICENSE.txt} +0 -0
  257. /package/dist/{800.js.LICENSE.txt → 831.js.LICENSE.txt} +0 -0
@@ -1,68 +1,67 @@
1
- import React from "react";
2
- import { of } from "rxjs";
3
- import {
4
- render,
5
- fireEvent,
6
- screen,
7
- within,
8
- waitFor,
9
- } from "@testing-library/react";
10
- import MockDate from "mockdate";
11
- import ReferralsQueue from "./referrals-queue.component";
12
- import { getReferrals } from "./referrals-queue.resource";
13
-
14
- jest.mock("./referrals-queue.resource");
1
+ import { defineConfigSchema } from '@openmrs/esm-framework';
2
+ import React from 'react';
3
+ import { of } from 'rxjs';
4
+ import { render, fireEvent, screen, within, waitFor } from '@testing-library/react';
5
+ import MockDate from 'mockdate';
6
+ import ReferralsQueue from './referrals-queue.component';
7
+ import { getReferrals } from './referrals-queue.resource';
8
+ import { configSchema } from '../config-schema';
9
+
10
+ jest.mock('./referrals-queue.resource');
15
11
  const mockedGetReferrals = getReferrals as jest.Mock;
16
12
 
17
13
  const referrals = [
18
14
  {
19
- patient_uuid: "ptaaaaaa-2869-41a4-86af-811fa2ee65b8",
20
- zl_emr_id: "PTID1",
21
- patient_name: "Patient Commcare",
22
- referral_date: "2020-03-25T00:00:00.000-0400",
15
+ patient_uuid: 'ptaaaaaa-2869-41a4-86af-811fa2ee65b8',
16
+ zl_emr_id: 'PTID1',
17
+ patient_name: 'Patient Commcare',
18
+ referral_date: '2020-03-25T00:00:00.000-0400',
23
19
  details: null,
24
- visit_uuid: "visitaaa-091a-46fd-a442-2a9778d91a52",
20
+ visit_uuid: 'visitaaa-091a-46fd-a442-2a9778d91a52',
25
21
  encounter_id: 12,
26
- referral_type: "Test Referral Type",
27
- encounter_uuid: "encounter-0fe1-4318-95a4-641d31745e09",
22
+ referral_type: 'Test Referral Type',
23
+ encounter_uuid: 'encounter-0fe1-4318-95a4-641d31745e09',
28
24
  fulfillment_status: null,
29
25
  },
30
26
  {
31
- patient_uuid: "ptbbbbbb-de0e-489f-b4c7-fe4579e07aa9",
32
- zl_emr_id: "PTID2",
33
- patient_name: "Davina Mother",
34
- referral_date: "2020-03-23T00:00:00.000-0400",
35
- details: "Suspected depression",
36
- visit_uuid: "visitbbb-64ca-4d53-9024-574a9214f76e",
27
+ patient_uuid: 'ptbbbbbb-de0e-489f-b4c7-fe4579e07aa9',
28
+ zl_emr_id: 'PTID2',
29
+ patient_name: 'Davina Mother',
30
+ referral_date: '2020-03-23T00:00:00.000-0400',
31
+ details: 'Suspected depression',
32
+ visit_uuid: 'visitbbb-64ca-4d53-9024-574a9214f76e',
37
33
  encounter_id: 13,
38
- referral_type: "Mental Health",
39
- encounter_uuid: "encounter-d5cb-4f7e-a1aa-bd6741a96381",
40
- fulfillment_status: "Pending status",
34
+ referral_type: 'Mental Health',
35
+ encounter_uuid: 'encounter-d5cb-4f7e-a1aa-bd6741a96381',
36
+ fulfillment_status: 'Pending status',
41
37
  },
42
38
  {
43
- person_uuid: "ptcccccc-de0e-489f-b4c7-fe4579e07aa9",
44
- zl_emr_id: "PTID3",
45
- patient_name: "Patient Prenatal",
46
- referral_date: "2020-03-28T00:00:00.000-0400",
47
- details: "Urgent",
48
- visit_uuid: "visitccc-64ca-4d53-9024-574a9214f76e",
39
+ person_uuid: 'ptcccccc-de0e-489f-b4c7-fe4579e07aa9',
40
+ zl_emr_id: 'PTID3',
41
+ patient_name: 'Patient Prenatal',
42
+ referral_date: '2020-03-28T00:00:00.000-0400',
43
+ details: 'Urgent',
44
+ visit_uuid: 'visitccc-64ca-4d53-9024-574a9214f76e',
49
45
  encounter_id: 14,
50
- referral_type: "Family Member",
51
- encounter_uuid: "encounter-67bc-435d-9929-670a98cefe4e",
52
- fulfillment_status: "Test Complete",
46
+ referral_type: 'Family Member',
47
+ encounter_uuid: 'encounter-67bc-435d-9929-670a98cefe4e',
48
+ fulfillment_status: 'Test Complete',
53
49
  },
54
50
  ];
55
51
 
56
- (window as any).openmrsBase = "/openmrs";
52
+ (window as any).openmrsBase = '/openmrs';
57
53
  // hack around js-dom to make navigation testable
58
54
  delete window.location;
59
55
  //@ts-ignore
60
- window.location = { href: "/referrals-queue" };
56
+ window.location = { href: '/referrals-queue' };
61
57
 
62
- describe("referrals queue", () => {
63
- const todayString = "2020-10-31";
58
+ describe('referrals queue', () => {
59
+ const todayString = '2020-10-31';
60
+ beforeAll(() => {
61
+ defineConfigSchema('@pih/esm-referral-queues-app', configSchema);
62
+ });
64
63
  beforeEach(() => {
65
- MockDate.set(todayString + "T10:00:00.000-0400");
64
+ MockDate.set(todayString + 'T10:00:00.000-0400');
66
65
  mockedGetReferrals.mockReset();
67
66
  mockedGetReferrals.mockReturnValue(of(referrals));
68
67
  render(<ReferralsQueue />);
@@ -72,15 +71,15 @@ describe("referrals queue", () => {
72
71
  MockDate.reset();
73
72
  });
74
73
 
75
- it("renders without failing", () => {
74
+ it('renders without failing', () => {
76
75
  // in beforeEach
77
76
  });
78
77
 
79
- it("renders the expected fields", () => {
78
+ it('renders the expected fields', () => {
80
79
  for (let referral of referrals) {
81
- const row = screen.getByText(referral.zl_emr_id).closest("tr");
80
+ const row = screen.getByText(referral.zl_emr_id).closest('tr');
82
81
  within(row).getByText(referral.patient_name);
83
- within(row).getByText(referral.referral_type, { selector: "td" });
82
+ within(row).getByText(referral.referral_type, { selector: 'td' });
84
83
  if (referral.details) {
85
84
  within(row).getByText(referral.details);
86
85
  }
@@ -88,122 +87,130 @@ describe("referrals queue", () => {
88
87
  within(row).getByText(referral.fulfillment_status);
89
88
  }
90
89
  }
91
- screen.getByText("25 Mar");
92
- screen.getByText("23 Mar");
93
- screen.getByText("28 Mar");
90
+ screen.getByText('25 Mar');
91
+ screen.getByText('23 Mar');
92
+ screen.getByText('28 Mar');
94
93
  });
95
94
 
96
95
  // TODO figure out how to test links
97
- it.skip("navigates to the links", async () => {
98
- const table = screen.getByRole("table");
96
+ it.skip('navigates to the links', async () => {
97
+ const table = screen.getByRole('table');
99
98
  const pt0DashLink = within(table).getByText(referrals[0].zl_emr_id);
100
99
  fireEvent.click(pt0DashLink);
101
100
  await waitFor(() => {
102
- expect(window.location.href).toBe(
103
- "/openmrs/pt-dash/" + referrals[0].patient_uuid
104
- );
101
+ expect(window.location.href).toBe('/openmrs/pt-dash/' + referrals[0].patient_uuid);
105
102
  });
106
- const pt1VisitLink = within(table).getByText("23 Mar");
103
+ const pt1VisitLink = within(table).getByText('23 Mar');
107
104
  fireEvent.click(pt1VisitLink);
108
105
  await waitFor(() => {
109
- expect(window.location.href).toBe(
110
- `/openmrs/visit/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}`
111
- );
106
+ expect(window.location.href).toBe(`/openmrs/visit/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}`);
112
107
  });
113
- const pendingStatusLink = within(table).getByText("Pending status");
108
+ const pendingStatusLink = within(table).getByText('Pending status');
114
109
  fireEvent.click(pendingStatusLink);
115
110
  await waitFor(() => {
116
111
  expect(window.location.href).toBe(
117
- `/openmrs/home-visit-form/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}/${referrals[1].encounter_uuid}`
112
+ `/openmrs/home-visit-form/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}/${referrals[1].encounter_uuid}`,
118
113
  );
119
114
  });
120
115
  });
121
116
 
122
117
  it("doesn't make non-pending statuses into links", () => {
123
- const table = screen.getByRole("table");
124
- expect(within(table).getByText("Pending status").tagName).toBe("A"); // sanity check
125
- expect(within(table).getByText("Test Complete").tagName).not.toBe("A"); // the actual test
118
+ const table = screen.getByRole('table');
119
+ expect(within(table).getByText('Pending status').tagName).toBe('A'); // sanity check
120
+ expect(within(table).getByText('Test Complete').tagName).not.toBe('A'); // the actual test
126
121
  });
127
122
 
128
- it("filters by referral type", () => {
129
- fireEvent.click(screen.getByLabelText("Referral Type", {
130
- selector: "button",
131
- }));
132
- fireEvent.click(screen.getByText("Mental Health", {
133
- selector: "div"
134
- }));
135
- expect(screen.queryByText("PTID1")).toBeNull();
136
- expect(screen.queryByText("PTID2")).not.toBeNull();
137
- expect(screen.queryByText("PTID3")).toBeNull();
123
+ it('filters by referral type', () => {
124
+ fireEvent.click(
125
+ screen.getByLabelText('Referral Type', {
126
+ selector: 'button',
127
+ }),
128
+ );
129
+ fireEvent.click(
130
+ screen.getByText('Mental Health', {
131
+ selector: 'div',
132
+ }),
133
+ );
134
+ expect(screen.queryByText('PTID1')).toBeNull();
135
+ expect(screen.queryByText('PTID2')).not.toBeNull();
136
+ expect(screen.queryByText('PTID3')).toBeNull();
138
137
  });
139
138
 
140
- it("infers list of referral types from data", () => {
141
- expect(screen.queryByText("Test Referral Type", { selector: "span" })).toBeNull(); // sanity check
142
- fireEvent.click(screen.getByLabelText("Referral Type", {
143
- selector: "button",
144
- }));
145
- fireEvent.click(screen.getByText("Test Referral Type", {
146
- selector: "div"
147
- }));
148
- expect(screen.queryByText("Test Referral Type", { selector: "span" })).not.toBeNull();
139
+ it('infers list of referral types from data', () => {
140
+ expect(screen.queryByText('Test Referral Type', { selector: 'span' })).toBeNull(); // sanity check
141
+ fireEvent.click(
142
+ screen.getByLabelText('Referral Type', {
143
+ selector: 'button',
144
+ }),
145
+ );
146
+ fireEvent.click(
147
+ screen.getByText('Test Referral Type', {
148
+ selector: 'div',
149
+ }),
150
+ );
151
+ expect(screen.queryByText('Test Referral Type', { selector: 'span' })).not.toBeNull();
149
152
  });
150
153
 
151
- it("filters by statuses, with dropdown inferred from data", () => {
152
- fireEvent.click(screen.getByLabelText("Status", {
153
- selector: "button",
154
- }));
155
- fireEvent.click(screen.getByText("Test Complete", {
156
- selector: "div"
157
- }));
158
- expect(screen.queryByText("PTID1")).toBeNull();
159
- expect(screen.queryByText("PTID2")).toBeNull();
160
- expect(screen.queryByText("PTID3")).not.toBeNull();
154
+ it('filters by statuses, with dropdown inferred from data', () => {
155
+ fireEvent.click(
156
+ screen.getByLabelText('Status', {
157
+ selector: 'button',
158
+ }),
159
+ );
160
+ fireEvent.click(
161
+ screen.getByText('Test Complete', {
162
+ selector: 'div',
163
+ }),
164
+ );
165
+ expect(screen.queryByText('PTID1')).toBeNull();
166
+ expect(screen.queryByText('PTID2')).toBeNull();
167
+ expect(screen.queryByText('PTID3')).not.toBeNull();
161
168
  });
162
169
 
163
170
  // TODO figure out how to interact with Carbon datepicker
164
- it.skip("calls getReferrals with the correct date arguments", () => {
165
- const monthAgoString = "2020-09-30";
171
+ it.skip('calls getReferrals with the correct date arguments', () => {
172
+ const monthAgoString = '2020-09-30';
166
173
  expect(mockedGetReferrals).lastCalledWith({
167
174
  fromDate: monthAgoString,
168
175
  toDate: todayString,
169
- locale: "en",
176
+ locale: 'en',
170
177
  });
171
- const fromDateInput = screen.getByLabelText("From");
172
- fireEvent.change(fromDateInput, { target: { value: "2020-01-01" } });
178
+ const fromDateInput = screen.getByLabelText('From');
179
+ fireEvent.change(fromDateInput, { target: { value: '2020-01-01' } });
173
180
  expect(mockedGetReferrals).lastCalledWith({
174
- fromDate: "2020-01-01",
181
+ fromDate: '2020-01-01',
175
182
  toDate: todayString,
176
- locale: "en",
183
+ locale: 'en',
177
184
  });
178
- const toDateInput = screen.getByLabelText("To");
179
- fireEvent.change(toDateInput, { target: { value: "2020-03-01" } });
185
+ const toDateInput = screen.getByLabelText('To');
186
+ fireEvent.change(toDateInput, { target: { value: '2020-03-01' } });
180
187
  expect(mockedGetReferrals).lastCalledWith({
181
- fromDate: "2020-01-01",
182
- toDate: "2020-03-01",
183
- locale: "en",
188
+ fromDate: '2020-01-01',
189
+ toDate: '2020-03-01',
190
+ locale: 'en',
184
191
  });
185
192
  });
186
193
 
187
- it("filters the list of results by patient name query", () => {
188
- const queryBox = screen.getByLabelText("Filter by patient");
189
- fireEvent.change(queryBox, { target: { value: "Mother" } });
190
- expect(screen.queryByText("PTID2")).not.toBeNull();
191
- expect(screen.queryByText("PTID1")).toBeNull();
194
+ it('filters the list of results by patient name query', () => {
195
+ const queryBox = screen.getByLabelText('Filter by patient');
196
+ fireEvent.change(queryBox, { target: { value: 'Mother' } });
197
+ expect(screen.queryByText('PTID2')).not.toBeNull();
198
+ expect(screen.queryByText('PTID1')).toBeNull();
192
199
  });
193
200
 
194
- it("filters the list of results by patient name partial token matches", () => {
195
- const queryBox = screen.getByLabelText("Filter by patient");
196
- fireEvent.change(queryBox, { target: { value: "dav mo" } });
197
- expect(screen.queryByText("PTID2")).not.toBeNull();
198
- expect(screen.queryByText("PTID1")).toBeNull();
201
+ it('filters the list of results by patient name partial token matches', () => {
202
+ const queryBox = screen.getByLabelText('Filter by patient');
203
+ fireEvent.change(queryBox, { target: { value: 'dav mo' } });
204
+ expect(screen.queryByText('PTID2')).not.toBeNull();
205
+ expect(screen.queryByText('PTID1')).toBeNull();
199
206
  });
200
207
 
201
- it("filters the list of results by patient id", () => {
202
- const queryBox = screen.getByLabelText("Filter by patient");
203
- fireEvent.change(queryBox, { target: { value: "ptid1" } });
204
- expect(screen.queryByText("PTID1")).not.toBeNull();
205
- expect(screen.queryByText("PTID2")).toBeNull();
208
+ it('filters the list of results by patient id', () => {
209
+ const queryBox = screen.getByLabelText('Filter by patient');
210
+ fireEvent.change(queryBox, { target: { value: 'ptid1' } });
211
+ expect(screen.queryByText('PTID1')).not.toBeNull();
212
+ expect(screen.queryByText('PTID2')).toBeNull();
206
213
  });
207
214
 
208
- test.todo("makes the API call with the locale from the user session");
215
+ test.todo('makes the API call with the locale from the user session');
209
216
  });
@@ -1,6 +1,6 @@
1
- import React from "react";
2
- import { render } from "@testing-library/react";
3
- import Root from "./root.component";
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import Root from './root.component';
4
4
 
5
5
  describe(`<Root />`, () => {
6
6
  it(`renders without dying`, async () => {
@@ -1,8 +1,8 @@
1
- import React from "react";
2
- import { BrowserRouter, Routes, Route } from "react-router-dom";
3
- import ReferralsQueue from "./referrals-queue/referrals-queue.component";
4
- import styles from "./root.css";
5
- import { appPath } from "./constants";
1
+ import React from 'react';
2
+ import { BrowserRouter, Routes, Route } from 'react-router-dom';
3
+ import ReferralsQueue from './referrals-queue/referrals-queue.component';
4
+ import styles from './root.css';
5
+ import { appPath } from './constants';
6
6
 
7
7
  export default function Root() {
8
8
  return (
@@ -1,7 +1,7 @@
1
- import "@testing-library/jest-dom/extend-expect";
1
+ import '@testing-library/jest-dom/extend-expect';
2
2
 
3
- jest.mock("@openmrs/esm-framework", () => {
4
- const originalModule = jest.requireActual("@openmrs/esm-framework");
3
+ jest.mock('@openmrs/esm-framework', () => {
4
+ const originalModule = jest.requireActual('@openmrs/esm-framework');
5
5
 
6
6
  return {
7
7
  ...originalModule,
@@ -9,16 +9,16 @@ jest.mock("@openmrs/esm-framework", () => {
9
9
  return {
10
10
  links: {
11
11
  patientDash:
12
- "${openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}&app=pih.app.clinicianDashboard",
12
+ '${openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}&app=pih.app.clinicianDashboard',
13
13
  visitPage:
14
- "${openmrsBase}/pihcore/visit/visit.page?patient=${patientUuid}&visit=${visitUuid}&suppressActions=true#/overview",
14
+ '${openmrsBase}/pihcore/visit/visit.page?patient=${patientUuid}&visit=${visitUuid}&suppressActions=true#/overview',
15
15
  homeVisitForm:
16
- "${openmrsBase}/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId=${patientUuid}&visitId=${visitUuid}&encounterId=${encounterUuid}&definitionUiResource=file:configuration/pih/htmlforms/section-mch-referral.xml&returnUrl=/mirebalais/spa/referrals-queue",
16
+ '${openmrsBase}/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId=${patientUuid}&visitId=${visitUuid}&encounterId=${encounterUuid}&definitionUiResource=file:configuration/pih/htmlforms/section-mch-referral.xml&returnUrl=/mirebalais/spa/referrals-queue',
17
17
  },
18
- pendingStatuses: ["Pending status", "Referral unmet"],
18
+ pendingStatuses: ['Pending status', 'Referral unmet'],
19
19
  };
20
20
  }),
21
21
  };
22
22
  });
23
23
 
24
- window.getOpenmrsSpaBase = () => "openmrs/spa";
24
+ window.getOpenmrsSpaBase = () => 'openmrs/spa';
@@ -1,19 +1,8 @@
1
- import React from "react";
2
- import {
3
- Table,
4
- TableHead,
5
- TableHeader,
6
- TableRow,
7
- TableBody,
8
- TableCell,
9
- } from "@carbon/react";
10
- import {
11
- ConfigurableLink,
12
- interpolateString,
13
- useConfig,
14
- } from "@openmrs/esm-framework";
15
- import { Trans } from "react-i18next";
16
- import { formatDate } from "../util";
1
+ import React from 'react';
2
+ import { Table, TableHead, TableHeader, TableRow, TableBody, TableCell } from '@carbon/react';
3
+ import { ConfigurableLink, interpolateString, useConfig } from '@openmrs/esm-framework';
4
+ import { Trans } from 'react-i18next';
5
+ import { formatDate } from '../util';
17
6
 
18
7
  export interface ReferralsTableProps {
19
8
  referrals: Referral[];
@@ -54,10 +43,8 @@ export default function ReferrablesTable(props: ReferralsTableProps) {
54
43
  <TableCell>
55
44
  <ConfigurableLink
56
45
  to={interpolateString(config.links.patientDash, {
57
- patientUuid:
58
- referral.patient_uuid || referral.person_uuid,
59
- })}
60
- >
46
+ patientUuid: referral.patient_uuid || referral.person_uuid,
47
+ })}>
61
48
  {referral.zl_emr_id}
62
49
  </ConfigurableLink>
63
50
  </TableCell>
@@ -65,28 +52,22 @@ export default function ReferrablesTable(props: ReferralsTableProps) {
65
52
  <TableCell>
66
53
  <ConfigurableLink
67
54
  to={interpolateString(config.links.visitPage, {
68
- patientUuid:
69
- referral.patient_uuid || referral.person_uuid,
55
+ patientUuid: referral.patient_uuid || referral.person_uuid,
70
56
  visitUuid: referral.visit_uuid,
71
- })}
72
- >
57
+ })}>
73
58
  {formatDate(referral.referral_date)}
74
59
  </ConfigurableLink>
75
60
  </TableCell>
76
61
  <TableCell>{referral.referral_type}</TableCell>
77
62
  <TableCell>{referral.details}</TableCell>
78
63
  <TableCell>
79
- {config.pendingStatuses.includes(
80
- referral.fulfillment_status
81
- ) ? (
64
+ {config.pendingStatuses.includes(referral.fulfillment_status) ? (
82
65
  <ConfigurableLink
83
66
  to={interpolateString(config.links.homeVisitForm, {
84
- patientUuid:
85
- referral.patient_uuid || referral.person_uuid,
67
+ patientUuid: referral.patient_uuid || referral.person_uuid,
86
68
  visitUuid: referral.visit_uuid,
87
69
  encounterUuid: referral.encounter_uuid,
88
- })}
89
- >
70
+ })}>
90
71
  {referral.fulfillment_status}
91
72
  </ConfigurableLink>
92
73
  ) : (
package/src/util.ts CHANGED
@@ -1,4 +1,4 @@
1
- import moment from "moment";
1
+ import moment from 'moment';
2
2
 
3
3
  // We use UTC for the present TZ because the dates in the data
4
4
  // are all midnight Eastern Time, which lines up with UTC
@@ -6,15 +6,11 @@ import moment from "moment";
6
6
  export function formatDate(strDate: string) {
7
7
  const date = moment.utc(strDate);
8
8
  const today = moment.utc(new Date());
9
- if (
10
- date.date() === today.date() &&
11
- date.month() === today.month() &&
12
- date.year() === today.year()
13
- ) {
14
- return moment().calendar().split(" ")[0]; // locale-specific 'Today'
9
+ if (date.date() === today.date() && date.month() === today.month() && date.year() === today.year()) {
10
+ return moment().calendar().split(' ')[0]; // locale-specific 'Today'
15
11
  } else if (date.year() === today.year()) {
16
- return date.format("DD MMM");
12
+ return date.format('DD MMM');
17
13
  } else {
18
- return date.format("DD MMM YYYY");
14
+ return date.format('DD MMM YYYY');
19
15
  }
20
16
  }
package/tsconfig.json CHANGED
@@ -1,23 +1,5 @@
1
1
  {
2
- "compilerOptions": {
3
- "esModuleInterop": true,
4
- "module": "esnext",
5
- "allowSyntheticDefaultImports": true,
6
- "jsx": "react",
7
- "skipLibCheck": true,
8
- "moduleResolution": "node",
9
- "lib": [
10
- "dom",
11
- "es5",
12
- "scripthost",
13
- "es2015",
14
- "es2015.promise",
15
- "es2016.array.include",
16
- "es2018",
17
- "es2020"
18
- ],
19
- "resolveJsonModule": true,
20
- "noEmit": true,
21
- "target": "esnext"
22
- }
23
- }
2
+ "extends": "../../tsconfig.json",
3
+ "include": ["src/**/*"],
4
+ "exclude": ["src/**/*.test.tsx"]
5
+ }
package/.editorconfig DELETED
@@ -1,12 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- charset = utf-8
7
- trim_trailing_whitespace = true
8
- insert_final_newline = true
9
- end_of_line = lf
10
-
11
- [*.md]
12
- trim_trailing_whitespace = false
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- src/**/*.test.tsx
2
- **/*.d.tsx
package/.eslintrc DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "parser": "@typescript-eslint/parser",
3
- "extends": ["ts-react-important-stuff", "plugin:prettier/recommended"]
4
- }
@@ -1,79 +0,0 @@
1
- name: Node.js CI
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- pull_request:
7
- branches: [main]
8
- release:
9
- types:
10
- - created
11
-
12
- env:
13
- ESM_NAME: "@pih/esm-referrals-queue-app"
14
- JS_NAME: "esm-referrals-queue-app.js"
15
-
16
- jobs:
17
- build:
18
- runs-on: ubuntu-latest
19
-
20
- steps:
21
- - uses: actions/checkout@v2
22
- - name: Use Node.js
23
- uses: actions/setup-node@v1
24
- with:
25
- node-version: "16.x"
26
- - run: yarn
27
- - run: yarn lint
28
- - run: yarn coverage
29
- - run: yarn typescript
30
- - run: yarn build
31
- - name: Upload Artifacts
32
- uses: actions/upload-artifact@v2
33
- with:
34
- name: dist
35
- path: |
36
- dist
37
-
38
- pre_release:
39
- runs-on: ubuntu-latest
40
-
41
- needs: build
42
-
43
- if: ${{ github.event_name == 'push' }}
44
-
45
- steps:
46
- - uses: actions/checkout@v2
47
- - name: Download Artifacts
48
- uses: actions/download-artifact@v2
49
- - name: Use Node.js
50
- uses: actions/setup-node@v1
51
- with:
52
- node-version: "16.x"
53
- registry-url: "https://registry.npmjs.org"
54
- - run: yarn install
55
- - run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json'
56
- - run: yarn publish --access public --tag next
57
- env:
58
- NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
59
-
60
- release:
61
- runs-on: ubuntu-latest
62
-
63
- needs: build
64
-
65
- if: ${{ github.event_name == 'release' }}
66
-
67
- steps:
68
- - uses: actions/checkout@v2
69
- - name: Download Artifacts
70
- uses: actions/download-artifact@v2
71
- - name: Use Node.js
72
- uses: actions/setup-node@v1
73
- with:
74
- node-version: "16.x"
75
- registry-url: 'https://registry.npmjs.org'
76
- - run: yarn
77
- - run: yarn publish --access public
78
- env:
79
- NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
package/.husky/pre-push DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- set -e # die on error
5
-
6
- npx pretty-quick --staged
7
- yarn verify
package/.prettierignore DELETED
@@ -1,14 +0,0 @@
1
- # directories
2
- .husky/
3
- dist/
4
- node_modules/
5
-
6
- # dotfiles and generated
7
- .*
8
- yarn.lock
9
-
10
- # by file type
11
- **/*.css
12
- **/*.scss
13
- **/*.md
14
- **/*.json