@itwin/reports-config-widget-react 0.2.1 → 0.4.0

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 (343) hide show
  1. package/.rush/temp/operation/rebuild/all.log +9 -0
  2. package/.rush/temp/operation/rebuild/state.json +3 -0
  3. package/.rush/temp/package-deps_rebuild.json +48 -44
  4. package/.rush/temp/shrinkwrap-deps.json +228 -207
  5. package/CHANGELOG.json +44 -0
  6. package/CHANGELOG.md +24 -1
  7. package/coverage/clover.xml +562 -542
  8. package/coverage/coverage-final.json +24 -20
  9. package/coverage/lcov-report/index.html +51 -51
  10. package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +22 -22
  11. package/coverage/lcov-report/src/index.html +21 -21
  12. package/coverage/lcov-report/src/test/index.html +11 -11
  13. package/coverage/lcov-report/src/test/test-utils.tsx.html +20 -140
  14. package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +14 -35
  15. package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +26 -20
  16. package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +94 -109
  17. package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +55 -52
  18. package/coverage/lcov-report/src/widget/components/Constants.ts.html +1 -1
  19. package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +28 -46
  20. package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +1 -1
  21. package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +1 -1
  22. package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +1 -1
  23. package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +1 -1
  24. package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +1 -1
  25. package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +1 -1
  26. package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +1 -1
  27. package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +1 -1
  28. package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +3 -3
  29. package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +8 -8
  30. package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +36 -81
  31. package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +38 -41
  32. package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +46 -46
  33. package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +127 -142
  34. package/coverage/lcov-report/src/widget/components/Reports.tsx.html +189 -312
  35. package/coverage/lcov-report/src/widget/components/ReportsConfigContext.tsx.html +370 -0
  36. package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +111 -33
  37. package/coverage/lcov-report/src/widget/components/ReportsHeader.tsx.html +166 -0
  38. package/coverage/lcov-report/src/widget/components/ReportsRouter.tsx.html +274 -0
  39. package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +22 -7
  40. package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +40 -94
  41. package/coverage/lcov-report/src/widget/components/index.html +142 -97
  42. package/coverage/lcov-report/src/widget/components/utils.tsx.html +22 -19
  43. package/coverage/lcov-report/src/widget/context/{ReportsApiConfigContext.tsx.html → BulkExtractorContext.tsx.html} +23 -26
  44. package/coverage/lcov-report/src/widget/context/ReportsConfigApiContext.tsx.html +202 -0
  45. package/coverage/lcov-report/src/widget/context/index.html +30 -15
  46. package/coverage/lcov-report/src/widget/hooks/index.html +1 -1
  47. package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +11 -11
  48. package/coverage/lcov-report/src/widget/index.html +13 -13
  49. package/coverage/lcov.info +1036 -1034
  50. package/jest.config.js +1 -0
  51. package/lib/cjs/ReportsConfigWidget.js +1 -1
  52. package/lib/cjs/ReportsConfigWidget.js.map +1 -1
  53. package/lib/cjs/reports-config-widget-react.d.ts +5 -0
  54. package/lib/cjs/reports-config-widget-react.d.ts.map +1 -1
  55. package/lib/cjs/reports-config-widget-react.js +11 -0
  56. package/lib/cjs/reports-config-widget-react.js.map +1 -1
  57. package/lib/cjs/test/AddMappingModal.test.js +20 -34
  58. package/lib/cjs/test/AddMappingModal.test.js.map +1 -1
  59. package/lib/cjs/test/BulkExtractor.test.js +13 -19
  60. package/lib/cjs/test/BulkExtractor.test.js.map +1 -1
  61. package/lib/cjs/test/DeleteModal.test.d.ts.map +1 -1
  62. package/lib/cjs/test/DeleteModal.test.js +4 -62
  63. package/lib/cjs/test/DeleteModal.test.js.map +1 -1
  64. package/lib/cjs/test/ReportAction.test.js +14 -79
  65. package/lib/cjs/test/ReportAction.test.js.map +1 -1
  66. package/lib/cjs/test/ReportMappingHorizontalTile.test.js +20 -54
  67. package/lib/cjs/test/ReportMappingHorizontalTile.test.js.map +1 -1
  68. package/lib/cjs/test/ReportMappings.test.d.ts.map +1 -1
  69. package/lib/cjs/test/ReportMappings.test.js +51 -106
  70. package/lib/cjs/test/ReportMappings.test.js.map +1 -1
  71. package/lib/cjs/test/Reports.test.js +41 -96
  72. package/lib/cjs/test/Reports.test.js.map +1 -1
  73. package/lib/cjs/test/WidgetHeader.test.js +9 -3
  74. package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
  75. package/lib/cjs/test/test-utils.d.ts +3 -8
  76. package/lib/cjs/test/test-utils.d.ts.map +1 -1
  77. package/lib/cjs/test/test-utils.js +6 -34
  78. package/lib/cjs/test/test-utils.js.map +1 -1
  79. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  80. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts +3 -3
  81. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts.map +1 -1
  82. package/lib/cjs/widget/ReportsConfigUiProvider.js +5 -7
  83. package/lib/cjs/widget/ReportsConfigUiProvider.js.map +1 -1
  84. package/lib/cjs/widget/components/ActionPanel.d.ts +3 -3
  85. package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -1
  86. package/lib/cjs/widget/components/ActionPanel.js +4 -4
  87. package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
  88. package/lib/cjs/widget/components/ActionPanel.scss +2 -3
  89. package/lib/cjs/widget/components/AddMappingsModal.d.ts +4 -4
  90. package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
  91. package/lib/cjs/widget/components/AddMappingsModal.js +39 -43
  92. package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
  93. package/lib/cjs/widget/components/AddMappingsModal.scss +1 -2
  94. package/lib/cjs/widget/components/BulkExtractor.d.ts +4 -4
  95. package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -1
  96. package/lib/cjs/widget/components/BulkExtractor.js +8 -8
  97. package/lib/cjs/widget/components/BulkExtractor.js.map +1 -1
  98. package/lib/cjs/widget/components/DeleteModal.d.ts +4 -5
  99. package/lib/cjs/widget/components/DeleteModal.d.ts.map +1 -1
  100. package/lib/cjs/widget/components/DeleteModal.js +11 -15
  101. package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
  102. package/lib/cjs/widget/components/DeleteModal.scss +2 -3
  103. package/lib/cjs/widget/components/ExtractionStatus.js +2 -2
  104. package/lib/cjs/widget/components/ExtractionStatus.js.map +1 -1
  105. package/lib/cjs/widget/components/ExtractionStatus.scss +6 -7
  106. package/lib/cjs/widget/components/HorizontalTile.js +2 -2
  107. package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
  108. package/lib/cjs/widget/components/HorizontalTile.scss +11 -14
  109. package/lib/cjs/widget/components/LocalizedTablePaginator.js +2 -2
  110. package/lib/cjs/widget/components/LocalizedTablePaginator.js.map +1 -1
  111. package/lib/cjs/widget/components/ReportAction.d.ts +4 -5
  112. package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -1
  113. package/lib/cjs/widget/components/ReportAction.js +24 -26
  114. package/lib/cjs/widget/components/ReportAction.js.map +1 -1
  115. package/lib/cjs/widget/components/ReportAction.scss +1 -2
  116. package/lib/cjs/widget/components/ReportHorizontalTile.d.ts +4 -4
  117. package/lib/cjs/widget/components/ReportHorizontalTile.d.ts.map +1 -1
  118. package/lib/cjs/widget/components/ReportHorizontalTile.js +33 -20
  119. package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -1
  120. package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts +1 -1
  121. package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
  122. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js +36 -21
  123. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js.map +1 -1
  124. package/lib/cjs/widget/components/ReportMappings.d.ts +4 -6
  125. package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
  126. package/lib/cjs/widget/components/ReportMappings.js +50 -63
  127. package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
  128. package/lib/cjs/widget/components/ReportMappings.scss +10 -11
  129. package/lib/cjs/widget/components/Reports.d.ts +6 -1
  130. package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
  131. package/lib/cjs/widget/components/Reports.js +53 -94
  132. package/lib/cjs/widget/components/Reports.js.map +1 -1
  133. package/lib/cjs/widget/components/Reports.scss +15 -15
  134. package/lib/cjs/widget/components/ReportsConfigContext.d.ts +18 -0
  135. package/lib/cjs/widget/components/ReportsConfigContext.d.ts.map +1 -0
  136. package/lib/cjs/widget/components/ReportsConfigContext.js +79 -0
  137. package/lib/cjs/widget/components/ReportsConfigContext.js.map +1 -0
  138. package/lib/cjs/widget/components/ReportsContainer.d.ts +14 -0
  139. package/lib/cjs/widget/components/ReportsContainer.d.ts.map +1 -1
  140. package/lib/cjs/widget/components/ReportsContainer.js +27 -16
  141. package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
  142. package/lib/cjs/widget/components/ReportsContainer.scss +1 -3
  143. package/lib/cjs/widget/components/ReportsHeader.d.ts +7 -0
  144. package/lib/cjs/widget/components/ReportsHeader.d.ts.map +1 -0
  145. package/lib/cjs/widget/components/ReportsHeader.js +20 -0
  146. package/lib/cjs/widget/components/ReportsHeader.js.map +1 -0
  147. package/lib/cjs/widget/components/ReportsRouter.d.ts +8 -0
  148. package/lib/cjs/widget/components/ReportsRouter.d.ts.map +1 -0
  149. package/lib/cjs/widget/components/ReportsRouter.js +51 -0
  150. package/lib/cjs/widget/components/ReportsRouter.js.map +1 -0
  151. package/lib/cjs/widget/components/SearchBar.d.ts.map +1 -1
  152. package/lib/cjs/widget/components/SearchBar.js +4 -5
  153. package/lib/cjs/widget/components/SearchBar.js.map +1 -1
  154. package/lib/cjs/widget/components/SearchBar.scss +1 -2
  155. package/lib/cjs/widget/components/SelectIModel.d.ts +3 -3
  156. package/lib/cjs/widget/components/SelectIModel.d.ts.map +1 -1
  157. package/lib/cjs/widget/components/SelectIModel.js +10 -30
  158. package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
  159. package/lib/cjs/widget/components/SelectIModel.scss +2 -3
  160. package/lib/cjs/widget/components/utils.d.ts +1 -1
  161. package/lib/cjs/widget/components/utils.d.ts.map +1 -1
  162. package/lib/cjs/widget/components/utils.js +1 -1
  163. package/lib/cjs/widget/components/utils.js.map +1 -1
  164. package/lib/cjs/widget/components/utils.scss +16 -8
  165. package/lib/cjs/widget/context/BulkExtractorContext.d.ts +10 -0
  166. package/lib/cjs/widget/context/BulkExtractorContext.d.ts.map +1 -0
  167. package/lib/cjs/widget/context/{ReportsApiConfigContext.js → BulkExtractorContext.js} +7 -10
  168. package/lib/cjs/widget/context/BulkExtractorContext.js.map +1 -0
  169. package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts +16 -0
  170. package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts.map +1 -0
  171. package/lib/cjs/widget/context/ReportsConfigApiContext.js +43 -0
  172. package/lib/cjs/widget/context/ReportsConfigApiContext.js.map +1 -0
  173. package/lib/cjs/widget/hooks/useValidator.js +1 -1
  174. package/lib/cjs/widget/hooks/useValidator.js.map +1 -1
  175. package/lib/esm/ReportsConfigWidget.js +1 -1
  176. package/lib/esm/ReportsConfigWidget.js.map +1 -1
  177. package/lib/esm/reports-config-widget-react.d.ts +5 -0
  178. package/lib/esm/reports-config-widget-react.d.ts.map +1 -1
  179. package/lib/esm/reports-config-widget-react.js +5 -0
  180. package/lib/esm/reports-config-widget-react.js.map +1 -1
  181. package/lib/esm/test/AddMappingModal.test.js +17 -31
  182. package/lib/esm/test/AddMappingModal.test.js.map +1 -1
  183. package/lib/esm/test/BulkExtractor.test.js +14 -17
  184. package/lib/esm/test/BulkExtractor.test.js.map +1 -1
  185. package/lib/esm/test/DeleteModal.test.d.ts.map +1 -1
  186. package/lib/esm/test/DeleteModal.test.js +5 -44
  187. package/lib/esm/test/DeleteModal.test.js.map +1 -1
  188. package/lib/esm/test/ReportAction.test.js +14 -60
  189. package/lib/esm/test/ReportAction.test.js.map +1 -1
  190. package/lib/esm/test/ReportMappingHorizontalTile.test.js +4 -38
  191. package/lib/esm/test/ReportMappingHorizontalTile.test.js.map +1 -1
  192. package/lib/esm/test/ReportMappings.test.d.ts.map +1 -1
  193. package/lib/esm/test/ReportMappings.test.js +43 -98
  194. package/lib/esm/test/ReportMappings.test.js.map +1 -1
  195. package/lib/esm/test/Reports.test.js +24 -60
  196. package/lib/esm/test/Reports.test.js.map +1 -1
  197. package/lib/esm/test/WidgetHeader.test.js +8 -2
  198. package/lib/esm/test/WidgetHeader.test.js.map +1 -1
  199. package/lib/esm/test/test-utils.d.ts +3 -8
  200. package/lib/esm/test/test-utils.d.ts.map +1 -1
  201. package/lib/esm/test/test-utils.js +4 -31
  202. package/lib/esm/test/test-utils.js.map +1 -1
  203. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  204. package/lib/esm/widget/ReportsConfigUiProvider.d.ts +3 -3
  205. package/lib/esm/widget/ReportsConfigUiProvider.d.ts.map +1 -1
  206. package/lib/esm/widget/ReportsConfigUiProvider.js +2 -4
  207. package/lib/esm/widget/ReportsConfigUiProvider.js.map +1 -1
  208. package/lib/esm/widget/components/ActionPanel.d.ts +3 -3
  209. package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -1
  210. package/lib/esm/widget/components/ActionPanel.js +4 -4
  211. package/lib/esm/widget/components/ActionPanel.js.map +1 -1
  212. package/lib/esm/widget/components/ActionPanel.scss +2 -3
  213. package/lib/esm/widget/components/AddMappingsModal.d.ts +4 -4
  214. package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
  215. package/lib/esm/widget/components/AddMappingsModal.js +35 -39
  216. package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
  217. package/lib/esm/widget/components/AddMappingsModal.scss +1 -2
  218. package/lib/esm/widget/components/BulkExtractor.d.ts +4 -4
  219. package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -1
  220. package/lib/esm/widget/components/BulkExtractor.js +7 -8
  221. package/lib/esm/widget/components/BulkExtractor.js.map +1 -1
  222. package/lib/esm/widget/components/DeleteModal.d.ts +4 -5
  223. package/lib/esm/widget/components/DeleteModal.d.ts.map +1 -1
  224. package/lib/esm/widget/components/DeleteModal.js +11 -15
  225. package/lib/esm/widget/components/DeleteModal.js.map +1 -1
  226. package/lib/esm/widget/components/DeleteModal.scss +2 -3
  227. package/lib/esm/widget/components/ExtractionStatus.scss +6 -7
  228. package/lib/esm/widget/components/HorizontalTile.scss +11 -14
  229. package/lib/esm/widget/components/ReportAction.d.ts +4 -5
  230. package/lib/esm/widget/components/ReportAction.d.ts.map +1 -1
  231. package/lib/esm/widget/components/ReportAction.js +17 -21
  232. package/lib/esm/widget/components/ReportAction.js.map +1 -1
  233. package/lib/esm/widget/components/ReportAction.scss +1 -2
  234. package/lib/esm/widget/components/ReportHorizontalTile.d.ts +4 -4
  235. package/lib/esm/widget/components/ReportHorizontalTile.d.ts.map +1 -1
  236. package/lib/esm/widget/components/ReportHorizontalTile.js +6 -9
  237. package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -1
  238. package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts +1 -1
  239. package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
  240. package/lib/esm/widget/components/ReportMappingHorizontalTile.js +12 -13
  241. package/lib/esm/widget/components/ReportMappingHorizontalTile.js.map +1 -1
  242. package/lib/esm/widget/components/ReportMappings.d.ts +4 -6
  243. package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
  244. package/lib/esm/widget/components/ReportMappings.js +43 -56
  245. package/lib/esm/widget/components/ReportMappings.js.map +1 -1
  246. package/lib/esm/widget/components/ReportMappings.scss +10 -11
  247. package/lib/esm/widget/components/Reports.d.ts +6 -1
  248. package/lib/esm/widget/components/Reports.d.ts.map +1 -1
  249. package/lib/esm/widget/components/Reports.js +46 -87
  250. package/lib/esm/widget/components/Reports.js.map +1 -1
  251. package/lib/esm/widget/components/Reports.scss +15 -15
  252. package/lib/esm/widget/components/ReportsConfigContext.d.ts +18 -0
  253. package/lib/esm/widget/components/ReportsConfigContext.d.ts.map +1 -0
  254. package/lib/esm/widget/components/ReportsConfigContext.js +56 -0
  255. package/lib/esm/widget/components/ReportsConfigContext.js.map +1 -0
  256. package/lib/esm/widget/components/ReportsContainer.d.ts +14 -0
  257. package/lib/esm/widget/components/ReportsContainer.d.ts.map +1 -1
  258. package/lib/esm/widget/components/ReportsContainer.js +27 -17
  259. package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
  260. package/lib/esm/widget/components/ReportsContainer.scss +1 -3
  261. package/lib/esm/widget/components/ReportsHeader.d.ts +7 -0
  262. package/lib/esm/widget/components/ReportsHeader.d.ts.map +1 -0
  263. package/lib/esm/widget/components/ReportsHeader.js +13 -0
  264. package/lib/esm/widget/components/ReportsHeader.js.map +1 -0
  265. package/lib/esm/widget/components/ReportsRouter.d.ts +8 -0
  266. package/lib/esm/widget/components/ReportsRouter.d.ts.map +1 -0
  267. package/lib/esm/widget/components/ReportsRouter.js +44 -0
  268. package/lib/esm/widget/components/ReportsRouter.js.map +1 -0
  269. package/lib/esm/widget/components/SearchBar.d.ts.map +1 -1
  270. package/lib/esm/widget/components/SearchBar.js +2 -3
  271. package/lib/esm/widget/components/SearchBar.js.map +1 -1
  272. package/lib/esm/widget/components/SearchBar.scss +1 -2
  273. package/lib/esm/widget/components/SelectIModel.d.ts +3 -3
  274. package/lib/esm/widget/components/SelectIModel.d.ts.map +1 -1
  275. package/lib/esm/widget/components/SelectIModel.js +7 -27
  276. package/lib/esm/widget/components/SelectIModel.js.map +1 -1
  277. package/lib/esm/widget/components/SelectIModel.scss +2 -3
  278. package/lib/esm/widget/components/utils.d.ts +1 -1
  279. package/lib/esm/widget/components/utils.d.ts.map +1 -1
  280. package/lib/esm/widget/components/utils.js +2 -2
  281. package/lib/esm/widget/components/utils.js.map +1 -1
  282. package/lib/esm/widget/components/utils.scss +16 -8
  283. package/lib/esm/widget/context/BulkExtractorContext.d.ts +10 -0
  284. package/lib/esm/widget/context/BulkExtractorContext.d.ts.map +1 -0
  285. package/lib/esm/widget/context/BulkExtractorContext.js +11 -0
  286. package/lib/esm/widget/context/BulkExtractorContext.js.map +1 -0
  287. package/lib/esm/widget/context/ReportsConfigApiContext.d.ts +16 -0
  288. package/lib/esm/widget/context/ReportsConfigApiContext.d.ts.map +1 -0
  289. package/lib/esm/widget/context/ReportsConfigApiContext.js +20 -0
  290. package/lib/esm/widget/context/ReportsConfigApiContext.js.map +1 -0
  291. package/lib/public/locales/en/ReportsConfigWidget.json +6 -1
  292. package/package.json +29 -29
  293. package/public/locales/en/ReportsConfigWidget.json +6 -1
  294. package/reports-config-widget-react.build.error.log +6 -6
  295. package/reports-config-widget-react.build.log +52 -49
  296. package/src/reports-config-widget-react.ts +6 -0
  297. package/src/test/AddMappingModal.test.tsx +20 -37
  298. package/src/test/BulkExtractor.test.ts +15 -17
  299. package/src/test/DeleteModal.test.tsx +4 -73
  300. package/src/test/ReportAction.test.tsx +17 -90
  301. package/src/test/ReportMappingHorizontalTile.test.tsx +3 -54
  302. package/src/test/ReportMappings.test.tsx +50 -135
  303. package/src/test/Reports.test.tsx +21 -80
  304. package/src/test/WidgetHeader.test.tsx +9 -2
  305. package/src/test/test-utils.tsx +9 -49
  306. package/src/widget/ReportsConfigUiProvider.tsx +7 -14
  307. package/src/widget/components/ActionPanel.scss +2 -3
  308. package/src/widget/components/ActionPanel.tsx +17 -15
  309. package/src/widget/components/AddMappingsModal.scss +1 -2
  310. package/src/widget/components/AddMappingsModal.tsx +55 -60
  311. package/src/widget/components/BulkExtractor.ts +11 -10
  312. package/src/widget/components/DeleteModal.scss +2 -3
  313. package/src/widget/components/DeleteModal.tsx +17 -23
  314. package/src/widget/components/ExtractionStatus.scss +6 -7
  315. package/src/widget/components/HorizontalTile.scss +11 -14
  316. package/src/widget/components/ReportAction.scss +1 -2
  317. package/src/widget/components/ReportAction.tsx +18 -33
  318. package/src/widget/components/ReportHorizontalTile.tsx +11 -12
  319. package/src/widget/components/ReportMappingHorizontalTile.tsx +30 -30
  320. package/src/widget/components/ReportMappings.scss +10 -11
  321. package/src/widget/components/ReportMappings.tsx +67 -72
  322. package/src/widget/components/Reports.scss +15 -15
  323. package/src/widget/components/Reports.tsx +140 -181
  324. package/src/widget/components/ReportsConfigContext.tsx +95 -0
  325. package/src/widget/components/ReportsContainer.scss +1 -3
  326. package/src/widget/components/ReportsContainer.tsx +47 -21
  327. package/src/widget/components/ReportsHeader.tsx +27 -0
  328. package/src/widget/components/ReportsRouter.tsx +63 -0
  329. package/src/widget/components/SearchBar.scss +1 -2
  330. package/src/widget/components/SearchBar.tsx +7 -2
  331. package/src/widget/components/SelectIModel.scss +2 -3
  332. package/src/widget/components/SelectIModel.tsx +11 -29
  333. package/src/widget/components/utils.scss +16 -8
  334. package/src/widget/components/utils.tsx +8 -7
  335. package/src/widget/context/{ReportsApiConfigContext.tsx → BulkExtractorContext.tsx} +9 -10
  336. package/src/widget/context/ReportsConfigApiContext.tsx +39 -0
  337. package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts +0 -9
  338. package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts.map +0 -1
  339. package/lib/cjs/widget/context/ReportsApiConfigContext.js.map +0 -1
  340. package/lib/esm/widget/context/ReportsApiConfigContext.d.ts +0 -9
  341. package/lib/esm/widget/context/ReportsApiConfigContext.d.ts.map +0 -1
  342. package/lib/esm/widget/context/ReportsApiConfigContext.js +0 -14
  343. package/lib/esm/widget/context/ReportsApiConfigContext.js.map +0 -1
@@ -3,22 +3,20 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import React from "react";
6
- import faker from "@faker-js/faker";
7
6
  import "@testing-library/jest-dom";
8
- import { NoRenderApp } from "@itwin/core-frontend";
9
7
  import { ReportsConfigWidget } from "../ReportsConfigWidget";
10
- import { act, render, screen, TestUtils, waitForElementToBeRemoved, within, } from "./test-utils";
8
+ import { act, mockITwinId, render, screen, waitFor, waitForElementToBeRemoved, within, } from "./test-utils";
11
9
  import * as moq from "typemoq";
10
+ import { ExtractionClient, ReportsClient, } from "@itwin/insights-client";
12
11
  import { ReportMappings } from "../widget/components/ReportMappings";
13
12
  import { IModelState } from "@itwin/imodels-client-management";
14
- import { Presentation, SelectionChangeEvent, } from "@itwin/presentation-frontend";
13
+ import { BulkExtractor } from "../widget/components/BulkExtractor";
15
14
  import { Text } from "@itwin/itwinui-react";
16
15
  import { EmptyLocalization } from "@itwin/core-common";
17
- const mockITwinId = faker.datatype.uuid();
18
16
  // Lets work with two iModels for now.
19
- const mockIModelId1 = faker.datatype.uuid();
20
- const mockIModelId2 = faker.datatype.uuid();
21
- const mockReportId = faker.datatype.uuid();
17
+ const mockIModelId1 = "mockIModelId1";
18
+ const mockIModelId2 = "mockIModelId2";
19
+ const mockReportId = "mockReportId";
22
20
  const mockIModelsResponse = [
23
21
  {
24
22
  iModel: {
@@ -96,7 +94,7 @@ const mockReportMappingsFactory = () => {
96
94
  mappings: [
97
95
  {
98
96
  reportId: mockReportId,
99
- mappingId: faker.datatype.uuid(),
97
+ mappingId: "mockMappingId1",
100
98
  imodelId: mockIModelId1,
101
99
  _links: {
102
100
  report: {
@@ -112,7 +110,7 @@ const mockReportMappingsFactory = () => {
112
110
  },
113
111
  {
114
112
  reportId: mockReportId,
115
- mappingId: faker.datatype.uuid(),
113
+ mappingId: "mockMappingId2",
116
114
  imodelId: mockIModelId2,
117
115
  _links: {
118
116
  report: {
@@ -156,11 +154,6 @@ const mockMappingsFactory = (mockReportMappings) => {
156
154
  }));
157
155
  return mockMappings;
158
156
  };
159
- const connectionMock = moq.Mock.ofType();
160
- const mockBulkExtractor = moq.Mock.ofType();
161
- const selectionManagerMock = moq.Mock.ofType();
162
- const selectionScopesManagerMock = moq.Mock.ofType();
163
- const mockIModelsClient = moq.Mock.ofType();
164
157
  jest.mock("../widget/components/Constants.ts", () => ({
165
158
  STATUS_CHECK_INTERVAL: 10,
166
159
  }));
@@ -171,23 +164,16 @@ jest.mock("../widget/components/ReportMappingHorizontalTile", () => ({
171
164
  React.createElement(Text, { title: props.mapping.mappingDescription }, props.mapping.iModelName)));
172
165
  },
173
166
  }));
174
- jest.mock("@itwin/appui-react", () => ({
175
- ...jest.requireActual("@itwin/appui-react"),
176
- useActiveIModelConnection: () => connectionMock.object,
177
- }));
178
- let returnFn;
167
+ let onClose;
179
168
  jest.mock("../widget/components/AddMappingsModal", () => ({
180
169
  ...jest.requireActual("../widget/components/AddMappingsModal"),
181
170
  AddMappingsModal: (props) => {
182
- returnFn = props.returnFn;
171
+ onClose = props.onClose;
183
172
  return React.createElement("div", { "data-testid": "add-mappings-modal" });
184
173
  },
185
174
  }));
186
175
  jest.mock("@itwin/imodels-client-management", () => ({
187
176
  ...jest.requireActual("@itwin/imodels-client-management"),
188
- IModelsClient: jest.fn().mockImplementation(() => ({
189
- iModels: mockIModelsClient.object,
190
- })),
191
177
  toArray: jest.fn().mockImplementation(async () => {
192
178
  return mockProjectIModels.iModels;
193
179
  }),
@@ -195,82 +181,47 @@ jest.mock("@itwin/imodels-client-management", () => ({
195
181
  const mockGetMapping = jest.fn();
196
182
  const mockGetMappings = jest.fn();
197
183
  const mockGetReportMappings = jest.fn();
198
- const mockDeleteReportMapping = jest.fn();
199
- jest.mock("@itwin/insights-client", () => ({
200
- ...jest.requireActual("@itwin/insights-client"),
201
- MappingsClient: jest.fn().mockImplementation(() => ({
202
- getMapping: mockGetMapping,
203
- getMappings: mockGetMappings,
204
- })),
205
- ReportsClient: jest.fn().mockImplementation(() => ({
206
- getReportMappings: mockGetReportMappings,
207
- deleteReportMapping: mockDeleteReportMapping,
208
- })),
209
- }));
184
+ const mockIModelsClient = moq.Mock.ofType();
185
+ const mockIModelsClientOperations = moq.Mock.ofType();
186
+ const mockReportsClient = moq.Mock.ofType();
187
+ const mockMappingsClient = moq.Mock.ofType();
210
188
  beforeAll(async () => {
211
- await NoRenderApp.startup({ localization: new EmptyLocalization() });
212
- await Presentation.initialize();
213
- const selectionSet = moq.Mock.ofType();
214
- const onChanged = moq.Mock.ofType();
215
- selectionSet.setup((x) => x.elements).returns(() => new Set([]));
216
- selectionSet.setup((x) => x.onChanged).returns(() => onChanged.object);
217
- connectionMock
218
- .setup((x) => x.selectionSet)
219
- .returns(() => selectionSet.object);
220
- connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId1);
221
- connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);
222
- selectionManagerMock
223
- .setup((x) => x.selectionChange)
224
- .returns(() => new SelectionChangeEvent());
225
- selectionScopesManagerMock
226
- .setup(async (x) => x.getSelectionScopes(connectionMock.object))
227
- .returns(async () => []);
228
- selectionManagerMock
229
- .setup((x) => x.scopes)
230
- .returns(() => selectionScopesManagerMock.object);
231
- Presentation.setSelectionManager(selectionManagerMock.object);
232
- await TestUtils.initializeUiFramework(connectionMock.object);
233
- await ReportsConfigWidget.initialize();
234
- });
235
- afterAll(() => {
236
- TestUtils.terminateUiFramework();
189
+ const localization = new EmptyLocalization();
190
+ await ReportsConfigWidget.initialize(localization);
191
+ mockIModelsClientOperations.setup(async (x) => x.getSingle(moq.It.isObjectWith({ iModelId: mockIModelId1 })))
192
+ .returns(async () => mockIModelsResponse[0].iModel);
193
+ mockIModelsClientOperations.setup(async (x) => x.getSingle(moq.It.isObjectWith({ iModelId: mockIModelId2 })))
194
+ .returns(async () => mockIModelsResponse[1].iModel);
195
+ mockIModelsClient.setup((x) => x.iModels)
196
+ .returns(() => mockIModelsClientOperations.object);
197
+ mockReportsClient.setup(async (x) => x.getReportMappings(moq.It.isAny(), moq.It.isAny())).returns(mockGetReportMappings);
198
+ mockMappingsClient.setup(async (x) => x.getMappings(moq.It.isAny(), moq.It.isAny())).returns(mockGetMappings);
199
+ mockMappingsClient.setup(async (x) => x.getMapping(moq.It.isAny(), moq.It.isAny(), moq.It.isAny())).returns(mockGetMapping);
237
200
  });
238
201
  afterEach(() => {
239
202
  mockGetMapping.mockReset();
240
203
  mockGetMappings.mockReset();
241
204
  mockGetReportMappings.mockReset();
242
- mockDeleteReportMapping.mockReset();
243
- mockIModelsClient.reset();
244
- mockBulkExtractor.reset();
245
205
  });
246
206
  describe("Report Mappings View", () => {
247
207
  it("shows all report mappings", async () => {
248
208
  const mockReportMappings = mockReportMappingsFactory();
249
209
  const mockMappings = mockMappingsFactory(mockReportMappings);
250
- mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith({ iModelId: mockIModelId1 })))
251
- .returns(async () => mockIModelsResponse[0].iModel);
252
- mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith({ iModelId: mockIModelId2 })))
253
- .returns(async () => mockIModelsResponse[1].iModel);
254
210
  mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
255
211
  mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
256
- render(React.createElement(ReportMappings, { report: mockReport, bulkExtractor: mockBulkExtractor.object, goBack: jest.fn() }));
212
+ render(React.createElement(ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
257
213
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
258
214
  const horizontalTiles = screen.getAllByTestId("horizontal-tile");
259
215
  assertHorizontalTiles(horizontalTiles, mockMappings);
260
216
  });
261
217
  it("search for a report mapping", async () => {
262
- var _a, _b, _c, _d;
263
218
  const mockReportMappings = mockReportMappingsFactory();
264
219
  const mockMappings = mockMappingsFactory(mockReportMappings);
265
- mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith({ iModelId: mockIModelId1 })))
266
- .returns(async () => mockIModelsResponse[0].iModel);
267
- mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith({ iModelId: mockIModelId2 })))
268
- .returns(async () => mockIModelsResponse[1].iModel);
269
220
  mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
270
221
  mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
271
- const { user } = render(React.createElement(ReportMappings, { report: mockReport, bulkExtractor: mockBulkExtractor.object, goBack: jest.fn() }));
222
+ const { user } = render(React.createElement(ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
272
223
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
273
- const searchButton = within(screen.getByTestId(/rcw-search-bar/i)).getByRole("button");
224
+ const searchButton = screen.getByTestId(/rcw-search-button/i);
274
225
  await user.click(searchButton);
275
226
  const searchInput = screen.getByRole("textbox", {
276
227
  name: /search\-textbox/i,
@@ -281,26 +232,22 @@ describe("Report Mappings View", () => {
281
232
  expect(screen.getByText(mockMappings[0].mapping.mappingName)).toBeInTheDocument();
282
233
  // Be an exact match on description.
283
234
  await user.clear(searchInput);
284
- await user.type(searchInput, (_a = mockMappings[0].mapping.description) !== null && _a !== void 0 ? _a : "");
235
+ await user.type(searchInput, mockMappings[0].mapping.description ?? "");
285
236
  expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
286
- expect(screen.getByTitle((_b = mockMappings[0].mapping.description) !== null && _b !== void 0 ? _b : "")).toBeInTheDocument();
237
+ expect(screen.getByTitle(mockMappings[0].mapping.description ?? "")).toBeInTheDocument();
287
238
  // Be an exact match on iModel Name.
288
239
  const iModel = mockIModelsResponse.find((mockIModel) => mockIModel.iModel.id === mockMappings[0].mapping._links.imodel.href);
289
240
  await user.clear(searchInput);
290
- await user.type(searchInput, (_c = iModel === null || iModel === void 0 ? void 0 : iModel.iModel.displayName) !== null && _c !== void 0 ? _c : "");
241
+ await user.type(searchInput, iModel?.iModel.displayName ?? "");
291
242
  expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
292
- expect(screen.getByText((_d = iModel === null || iModel === void 0 ? void 0 : iModel.iModel.displayName) !== null && _d !== void 0 ? _d : "")).toBeInTheDocument();
243
+ expect(screen.getByText(iModel?.iModel.displayName ?? "")).toBeInTheDocument();
293
244
  });
294
245
  it("add mapping", async () => {
295
246
  const mockReportMappings = mockReportMappingsFactory();
296
247
  const mockMappings = mockMappingsFactory(mockReportMappings);
297
- mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith({ iModelId: mockIModelId1 })))
298
- .returns(async () => mockIModelsResponse[0].iModel);
299
- mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith({ iModelId: mockIModelId2 })))
300
- .returns(async () => mockIModelsResponse[1].iModel);
301
248
  mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
302
249
  mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
303
- const { user } = render(React.createElement(ReportMappings, { report: mockReport, bulkExtractor: mockBulkExtractor.object, goBack: jest.fn() }));
250
+ const { user } = render(React.createElement(ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
304
251
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
305
252
  mockGetMappings.mockReturnValueOnce(mockMappings.map((m) => m.mapping));
306
253
  const addMappingButton = screen.getByRole("button", {
@@ -310,14 +257,14 @@ describe("Report Mappings View", () => {
310
257
  const addMappingsModal = await screen.findByTestId("add-mappings-modal");
311
258
  expect(addMappingsModal).toBeInTheDocument();
312
259
  await act(async () => {
313
- await returnFn();
260
+ await onClose();
314
261
  });
315
262
  const horizontalTiles = screen.getAllByTestId("horizontal-tile");
316
263
  assertHorizontalTiles(horizontalTiles, mockMappings);
317
264
  expect(mockGetReportMappings).toBeCalledTimes(2);
318
265
  });
319
266
  it("odata feed url", async () => {
320
- const { user } = render(React.createElement(ReportMappings, { report: mockReport, bulkExtractor: mockBulkExtractor.object, goBack: jest.fn() }));
267
+ const { user } = render(React.createElement(ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
321
268
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
322
269
  const urlTextbox = screen.getByRole("textbox", {
323
270
  name: /odatafeedurl/i,
@@ -333,30 +280,28 @@ describe("Report Mappings View", () => {
333
280
  it("update all datasets", async () => {
334
281
  const mockReportMappings = mockReportMappingsFactory();
335
282
  const mockMappings = mockMappingsFactory(mockReportMappings);
336
- mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith({ iModelId: mockIModelId1 })))
337
- .returns(async () => mockIModelsResponse[0].iModel);
338
- mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith({ iModelId: mockIModelId2 })))
339
- .returns(async () => mockIModelsResponse[1].iModel);
340
283
  mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
341
284
  mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
342
285
  const iModels = mockIModelsResponse.map((iModel) => iModel.iModel.id);
343
- mockBulkExtractor.setup(async (x) => x.runIModelExtractions(iModels)).returns(async () => Promise.resolve());
344
- const { user } = render(React.createElement(ReportMappings, { report: mockReport, bulkExtractor: mockBulkExtractor.object, goBack: jest.fn() }));
286
+ const bulkExtractor = new BulkExtractor(new ReportsClient(), new ExtractionClient(), jest.fn().mockResolvedValue("mockAccessToken"), jest.fn, jest.fn);
287
+ const runIModelExtractionsMock = jest.spyOn(bulkExtractor, "runIModelExtractions").mockImplementation(async () => Promise.resolve());
288
+ const { user } = render(React.createElement(ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object, bulkExtractor });
345
289
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
346
290
  const extractAllButton = screen.getByText(/UpdateAllDatasets/i);
347
291
  expect(extractAllButton).toBeInTheDocument();
348
292
  await user.click(extractAllButton);
349
- mockBulkExtractor.verify(async (x) => x.runIModelExtractions(iModels), moq.Times.once());
293
+ await waitFor(() => expect(extractAllButton).toBeEnabled());
294
+ // Check that the mocked method was called with the expected arguments
295
+ expect(runIModelExtractionsMock).toHaveBeenCalledWith(iModels);
350
296
  });
351
297
  const assertHorizontalTiles = (horizontalTiles, mockMappings) => {
352
- var _a, _b;
353
298
  expect(horizontalTiles).toHaveLength(mockMappings.length);
354
299
  for (const [index, horizontalTile] of horizontalTiles.entries()) {
355
300
  const reportMappingTile = within(horizontalTile);
356
301
  const mockiModel = mockIModelsResponse.find((iModel) => iModel.iModel.id === mockMappings[index].mapping._links.imodel.href);
357
302
  expect(reportMappingTile.getByText(mockMappings[index].mapping.mappingName)).toBeInTheDocument();
358
- expect(reportMappingTile.getByTitle((_a = mockMappings[index].mapping.description) !== null && _a !== void 0 ? _a : "")).toBeInTheDocument();
359
- expect(reportMappingTile.getByText((_b = mockiModel === null || mockiModel === void 0 ? void 0 : mockiModel.iModel.displayName) !== null && _b !== void 0 ? _b : "")).toBeInTheDocument();
303
+ expect(reportMappingTile.getByTitle(mockMappings[index].mapping.description ?? "")).toBeInTheDocument();
304
+ expect(reportMappingTile.getByText(mockiModel?.iModel.displayName ?? "")).toBeInTheDocument();
360
305
  }
361
306
  };
362
307
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ReportMappings.test.js","sourceRoot":"","sources":["../../../src/test/ReportMappings.test.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,2BAA2B,CAAC;AAMnC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,GAAG,EACH,MAAM,EACN,MAAM,EACN,SAAS,EACT,yBAAyB,EACzB,MAAM,GACP,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAO/B,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAK/D,OAAO,EACL,YAAY,EACZ,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC1C,sCAAsC;AACtC,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC5C,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAE5C,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAE3C,MAAM,mBAAmB,GAAG;IAC1B;QACE,MAAM,EAAE;YACN,E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vB;IACH,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport faker from \"@faker-js/faker\";\nimport \"@testing-library/jest-dom\";\nimport type {\n IModelConnection,\n SelectionSet,\n SelectionSetEvent,\n} from \"@itwin/core-frontend\";\nimport { NoRenderApp } from \"@itwin/core-frontend\";\nimport { ReportsConfigWidget } from \"../ReportsConfigWidget\";\nimport {\n act,\n render,\n screen,\n TestUtils,\n waitForElementToBeRemoved,\n within,\n} from \"./test-utils\";\nimport * as moq from \"typemoq\";\nimport type {\n MappingSingle,\n Report,\n ReportMappingCollection,\n} from \"@itwin/insights-client\";\nimport type { ReportMappingAndMapping } from \"../widget/components/ReportMappings\";\nimport { ReportMappings } from \"../widget/components/ReportMappings\";\nimport type { GetSingleIModelParams, IModelOperations, OperationOptions } from \"@itwin/imodels-client-management\";\nimport { IModelState } from \"@itwin/imodels-client-management\";\nimport type {\n SelectionManager,\n SelectionScopesManager,\n} from \"@itwin/presentation-frontend\";\nimport {\n Presentation,\n SelectionChangeEvent,\n} from \"@itwin/presentation-frontend\";\nimport type { BeEvent } from \"@itwin/core-bentley\";\nimport type BulkExtractor from \"../widget/components/BulkExtractor\";\nimport type { ReportMappingHorizontalTileProps } from \"../widget/components/ReportMappingHorizontalTile\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\n\nconst mockITwinId = faker.datatype.uuid();\n// Lets work with two iModels for now.\nconst mockIModelId1 = faker.datatype.uuid();\nconst mockIModelId2 = faker.datatype.uuid();\n\nconst mockReportId = faker.datatype.uuid();\n\nconst mockIModelsResponse = [\n {\n iModel: {\n id: mockIModelId1,\n displayName: \"rAnDoMdIsPlAynAmE1\",\n name: \"rAnDomName1\",\n description: \"rAnDoMDeScRiPtIoN1\",\n createdDateTime: \"2021-10-04T22:13:50.397Z\",\n state: IModelState.Initialized,\n projectId: mockITwinId,\n extent: null,\n _links: {\n creator: {\n href: \"\",\n },\n namedVersions: {\n href: \"\",\n },\n changesets: {\n href: \"\",\n },\n },\n },\n },\n {\n iModel: {\n id: mockIModelId2,\n displayName: \"rAnDoMdIsPlAynAmE2\",\n name: \"rAnDomName2\",\n description: \"rAnDoMDeScRiPtIoN2\",\n createdDateTime: \"2021-10-04T22:13:50.397Z\",\n state: IModelState.Initialized,\n projectId: mockITwinId,\n extent: null,\n _links: {\n creator: {\n href: \"\",\n },\n namedVersions: {\n href: \"\",\n },\n changesets: {\n href: \"\",\n },\n },\n },\n },\n];\n\nconst mockProjectIModels = {\n iModels: mockIModelsResponse.map((iModel) => ({\n id: iModel.iModel.id,\n displayName: iModel.iModel.displayName,\n })),\n _links: {\n self: {\n href: \"\",\n },\n prev: null,\n next: null,\n },\n};\n\nconst mockReport: Report = {\n id: mockReportId,\n displayName: \"mOcKRePoRt1\",\n description: \"mOcKRePoRtDeScRiPtIoN1\",\n deleted: false,\n _links: {\n project: {\n href: \"\",\n },\n },\n};\n\nconst mockReportMappingsFactory = (): ReportMappingCollection => {\n return {\n mappings: [\n {\n reportId: mockReportId,\n mappingId: faker.datatype.uuid(),\n imodelId: mockIModelId1,\n _links: {\n report: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n imodel: {\n href: \"\",\n },\n },\n },\n {\n reportId: mockReportId,\n mappingId: faker.datatype.uuid(),\n imodelId: mockIModelId2,\n _links: {\n report: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n imodel: {\n href: \"\",\n },\n },\n },\n ],\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n };\n};\n\nconst mockMappingsFactory = (\n mockReportMappings: ReportMappingCollection\n): MappingSingle[] => {\n const mockMappings: MappingSingle[] = mockReportMappings.mappings.map(\n (mapping, index) => ({\n mapping: {\n id: mapping.mappingId,\n mappingName: `mOcKMaPpIngNaMe${index}`,\n description: `mOcKmApPInGDeScRiPtIoN${index}`,\n extractionEnabled: false,\n createdOn: \"\",\n createdBy: \"\",\n modifiedOn: \"\",\n modifiedBy: \"\",\n _links: {\n imodel: {\n // Tie the mapping to to the iModel Id\n href: mapping.imodelId,\n },\n },\n },\n })\n );\n\n return mockMappings;\n};\n\nconst connectionMock = moq.Mock.ofType<IModelConnection>();\nconst mockBulkExtractor = moq.Mock.ofType<BulkExtractor>();\nconst selectionManagerMock = moq.Mock.ofType<SelectionManager>();\nconst selectionScopesManagerMock = moq.Mock.ofType<SelectionScopesManager>();\nconst mockIModelsClient = moq.Mock.ofType<IModelOperations<OperationOptions>>();\n\ninterface AddMappingsModalProps {\n reportId: string;\n existingMappings: ReportMappingAndMapping[];\n show: boolean;\n returnFn: () => Promise<void>;\n}\n\njest.mock(\"../widget/components/Constants.ts\", () => ({\n STATUS_CHECK_INTERVAL: 10,\n}));\n\njest.mock(\"../widget/components/ReportMappingHorizontalTile\", () => ({\n ReportMappingHorizontalTile: (props: ReportMappingHorizontalTileProps) => {\n return (<div data-testid=\"horizontal-tile\">\n <Text>{props.mapping.mappingName}</Text>\n <Text title={props.mapping.mappingDescription}>{props.mapping.iModelName}</Text>\n </div>);\n },\n}));\n\njest.mock(\"@itwin/appui-react\", () => ({\n ...jest.requireActual(\"@itwin/appui-react\"),\n useActiveIModelConnection: () => connectionMock.object,\n}));\n\nlet returnFn: () => Promise<void>;\njest.mock(\"../widget/components/AddMappingsModal\", () => ({\n ...jest.requireActual(\"../widget/components/AddMappingsModal\"),\n AddMappingsModal: (props: AddMappingsModalProps) => {\n returnFn = props.returnFn;\n return <div data-testid=\"add-mappings-modal\"/>;\n },\n}));\n\njest.mock(\"@itwin/imodels-client-management\", () => ({\n ...jest.requireActual(\"@itwin/imodels-client-management\"),\n IModelsClient: jest.fn().mockImplementation(() => ({\n iModels: mockIModelsClient.object,\n })),\n toArray: jest.fn().mockImplementation(async () => {\n return mockProjectIModels.iModels;\n }),\n}));\n\nconst mockGetMapping = jest.fn();\nconst mockGetMappings = jest.fn();\nconst mockGetReportMappings = jest.fn();\nconst mockDeleteReportMapping = jest.fn();\n\njest.mock(\"@itwin/insights-client\", () => ({\n ...jest.requireActual(\"@itwin/insights-client\"),\n MappingsClient: jest.fn().mockImplementation(() => ({\n getMapping: mockGetMapping,\n getMappings: mockGetMappings,\n })),\n ReportsClient: jest.fn().mockImplementation(() => ({\n getReportMappings: mockGetReportMappings,\n deleteReportMapping: mockDeleteReportMapping,\n })),\n}));\n\nbeforeAll(async () => {\n await NoRenderApp.startup({localization: new EmptyLocalization()});\n await Presentation.initialize();\n const selectionSet = moq.Mock.ofType<SelectionSet>();\n const onChanged = moq.Mock.ofType<BeEvent<(ev: SelectionSetEvent) => void>>();\n selectionSet.setup((x) => x.elements).returns(() => new Set([]));\n selectionSet.setup((x) => x.onChanged).returns(() => onChanged.object);\n connectionMock\n .setup((x) => x.selectionSet)\n .returns(() => selectionSet.object);\n connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId1);\n connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);\n\n selectionManagerMock\n .setup((x) => x.selectionChange)\n .returns(() => new SelectionChangeEvent());\n\n selectionScopesManagerMock\n .setup(async (x) => x.getSelectionScopes(connectionMock.object))\n .returns(async () => []);\n selectionManagerMock\n .setup((x) => x.scopes)\n .returns(() => selectionScopesManagerMock.object);\n\n Presentation.setSelectionManager(selectionManagerMock.object);\n await TestUtils.initializeUiFramework(connectionMock.object);\n await ReportsConfigWidget.initialize();\n});\n\nafterAll(() => {\n TestUtils.terminateUiFramework();\n});\n\nafterEach(() => {\n mockGetMapping.mockReset();\n mockGetMappings.mockReset();\n mockGetReportMappings.mockReset();\n mockDeleteReportMapping.mockReset();\n mockIModelsClient.reset();\n mockBulkExtractor.reset();\n});\n\ndescribe(\"Report Mappings View\", () => {\n it(\"shows all report mappings\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const mockMappings = mockMappingsFactory(mockReportMappings);\n\n mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))\n .returns(async () => mockIModelsResponse[0].iModel);\n\n mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))\n .returns(async () => mockIModelsResponse[1].iModel);\n\n mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);\n mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);\n\n render(<ReportMappings report={mockReport} bulkExtractor={mockBulkExtractor.object} goBack={jest.fn()} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const horizontalTiles = screen.getAllByTestId(\"horizontal-tile\");\n assertHorizontalTiles(horizontalTiles, mockMappings);\n });\n\n it(\"search for a report mapping\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const mockMappings = mockMappingsFactory(mockReportMappings);\n\n mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))\n .returns(async () => mockIModelsResponse[0].iModel);\n\n mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))\n .returns(async () => mockIModelsResponse[1].iModel);\n mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);\n mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);\n\n const { user } = render(\n <ReportMappings report={mockReport} bulkExtractor={mockBulkExtractor.object} goBack={jest.fn()} />\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const searchButton = within(screen.getByTestId(/rcw-search-bar/i)).getByRole(\n \"button\"\n );\n await user.click(searchButton);\n const searchInput = screen.getByRole(\"textbox\", {\n name: /search\\-textbox/i,\n });\n\n // Be an exact match on display name.\n await user.type(searchInput, mockMappings[0].mapping.mappingName);\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(mockMappings[0].mapping.mappingName)\n ).toBeInTheDocument();\n\n // Be an exact match on description.\n await user.clear(searchInput);\n await user.type(searchInput, mockMappings[0].mapping.description ?? \"\");\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByTitle(mockMappings[0].mapping.description ?? \"\")\n ).toBeInTheDocument();\n\n // Be an exact match on iModel Name.\n const iModel = mockIModelsResponse.find(\n (mockIModel) =>\n mockIModel.iModel.id === mockMappings[0].mapping._links.imodel.href\n );\n await user.clear(searchInput);\n await user.type(searchInput, iModel?.iModel.displayName ?? \"\");\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(iModel?.iModel.displayName ?? \"\")\n ).toBeInTheDocument();\n });\n\n it(\"add mapping\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const mockMappings = mockMappingsFactory(mockReportMappings);\n\n mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))\n .returns(async () => mockIModelsResponse[0].iModel);\n\n mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))\n .returns(async () => mockIModelsResponse[1].iModel);\n\n mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);\n mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);\n\n const { user } = render(\n <ReportMappings report={mockReport} bulkExtractor={mockBulkExtractor.object} goBack={jest.fn()} />\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n mockGetMappings.mockReturnValueOnce(mockMappings.map((m: MappingSingle) => m.mapping));\n\n const addMappingButton = screen.getByRole(\"button\", {\n name: /addmapping/i,\n });\n\n await user.click(addMappingButton);\n\n const addMappingsModal = await screen.findByTestId(\"add-mappings-modal\");\n expect(addMappingsModal).toBeInTheDocument();\n\n await act(async () => {\n await returnFn();\n });\n\n const horizontalTiles = screen.getAllByTestId(\"horizontal-tile\");\n assertHorizontalTiles(horizontalTiles, mockMappings);\n\n expect(mockGetReportMappings).toBeCalledTimes(2);\n });\n\n it(\"odata feed url\", async () => {\n const { user } = render(\n <ReportMappings report={mockReport} bulkExtractor={mockBulkExtractor.object} goBack={jest.fn()} />\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const urlTextbox = screen.getByRole(\"textbox\", {\n name: /odatafeedurl/i,\n });\n expect(urlTextbox).toBeInTheDocument();\n expect(\n screen.getByDisplayValue(\n `https://api.bentley.com/insights/reporting/odata/${mockReport.id}`\n )\n ).toBeInTheDocument();\n\n const copyButton = screen.getByRole(\"button\", {\n name: /copy/i,\n });\n\n await user.click(copyButton);\n expect(screen.getByText(/copiedtoclipboard/i)).toBeInTheDocument();\n });\n\n it(\"update all datasets\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const mockMappings = mockMappingsFactory(mockReportMappings);\n\n mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))\n .returns(async () => mockIModelsResponse[0].iModel);\n\n mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))\n .returns(async () => mockIModelsResponse[1].iModel);\n\n mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);\n mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);\n\n const iModels = mockIModelsResponse.map((iModel) => iModel.iModel.id);\n mockBulkExtractor.setup(async (x) => x.runIModelExtractions(iModels)).returns(async () => Promise.resolve());\n\n const { user } = render(<ReportMappings report={mockReport} bulkExtractor={mockBulkExtractor.object} goBack={jest.fn()} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const extractAllButton = screen.getByText(/UpdateAllDatasets/i);\n expect(extractAllButton).toBeInTheDocument();\n\n await user.click(extractAllButton);\n mockBulkExtractor.verify(async (x) => x.runIModelExtractions(iModels), moq.Times.once());\n });\n\n const assertHorizontalTiles = (horizontalTiles: HTMLElement[], mockMappings: MappingSingle[]) => {\n expect(horizontalTiles).toHaveLength(mockMappings.length);\n\n for (const [index, horizontalTile] of horizontalTiles.entries()) {\n const reportMappingTile = within(horizontalTile);\n const mockiModel = mockIModelsResponse.find(\n (iModel) =>\n iModel.iModel.id === mockMappings[index].mapping._links.imodel.href\n );\n expect(\n reportMappingTile.getByText(\n mockMappings[index].mapping.mappingName\n )\n ).toBeInTheDocument();\n expect(\n reportMappingTile.getByTitle(\n mockMappings[index].mapping.description ?? \"\"\n )\n ).toBeInTheDocument();\n expect(\n reportMappingTile.getByText(mockiModel?.iModel.displayName ?? \"\")\n ).toBeInTheDocument();\n }\n };\n});\n"]}
1
+ {"version":3,"file":"ReportMappings.test.js","sourceRoot":"","sources":["../../../src/test/ReportMappings.test.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,GAAG,EACH,WAAW,EACX,MAAM,EACN,MAAM,EACN,OAAO,EACP,yBAAyB,EACzB,MAAM,GACP,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAO/B,OAAO,EACL,gBAAgB,EAChB,aAAa,GACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAEnE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,O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A8B,EAAE,YAA6B,EAAE,EAAE;QAC9F,MAAM,CAAC,eAAe,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAE1D,KAAK,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,eAAe,CAAC,OAAO,EAAE,EAAE;YAC/D,MAAM,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;YACjD,MAAM,UAAU,GAAG,mBAAmB,CAAC,IAAI,CACzC,CAAC,MAAM,EAAE,EAAE,CACT,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,YAAY,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CACtE,CAAC;YACF,MAAM,CACJ,iBAAiB,CAAC,SAAS,CACzB,YAAY,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,WAAW,CACxC,CACF,CAAC,iBAAiB,EAAE,CAAC;YACtB,MAAM,CACJ,iBAAiB,CAAC,UAAU,CAC1B,YAAY,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAC9C,CACF,CAAC,iBAAiB,EAAE,CAAC;YACtB,MAAM,CACJ,iBAAiB,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,CAClE,CAAC,iBAAiB,EAAE,CAAC;SACvB;IACH,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport \"@testing-library/jest-dom\";\nimport { ReportsConfigWidget } from \"../ReportsConfigWidget\";\nimport {\n act,\n mockITwinId,\n render,\n screen,\n waitFor,\n waitForElementToBeRemoved,\n within,\n} from \"./test-utils\";\nimport * as moq from \"typemoq\";\nimport type {\n MappingsClient,\n MappingSingle,\n Report,\n ReportMappingCollection,\n} from \"@itwin/insights-client\";\nimport {\n ExtractionClient,\n ReportsClient,\n} from \"@itwin/insights-client\";\nimport { ReportMappings } from \"../widget/components/ReportMappings\";\nimport type { GetSingleIModelParams, IModelOperations, IModelsClient, OperationOptions } from \"@itwin/imodels-client-management\";\nimport { IModelState } from \"@itwin/imodels-client-management\";\nimport { BulkExtractor } from \"../widget/components/BulkExtractor\";\nimport type { ReportMappingHorizontalTileProps } from \"../widget/components/ReportMappingHorizontalTile\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\nimport type { AddMappingsModalProps } from \"../widget/components/AddMappingsModal\";\n\n// Lets work with two iModels for now.\nconst mockIModelId1 = \"mockIModelId1\";\nconst mockIModelId2 = \"mockIModelId2\";\n\nconst mockReportId = \"mockReportId\";\n\nconst mockIModelsResponse = [\n {\n iModel: {\n id: mockIModelId1,\n displayName: \"rAnDoMdIsPlAynAmE1\",\n name: \"rAnDomName1\",\n description: \"rAnDoMDeScRiPtIoN1\",\n createdDateTime: \"2021-10-04T22:13:50.397Z\",\n state: IModelState.Initialized,\n projectId: mockITwinId,\n extent: null,\n _links: {\n creator: {\n href: \"\",\n },\n namedVersions: {\n href: \"\",\n },\n changesets: {\n href: \"\",\n },\n },\n },\n },\n {\n iModel: {\n id: mockIModelId2,\n displayName: \"rAnDoMdIsPlAynAmE2\",\n name: \"rAnDomName2\",\n description: \"rAnDoMDeScRiPtIoN2\",\n createdDateTime: \"2021-10-04T22:13:50.397Z\",\n state: IModelState.Initialized,\n projectId: mockITwinId,\n extent: null,\n _links: {\n creator: {\n href: \"\",\n },\n namedVersions: {\n href: \"\",\n },\n changesets: {\n href: \"\",\n },\n },\n },\n },\n];\n\nconst mockProjectIModels = {\n iModels: mockIModelsResponse.map((iModel) => ({\n id: iModel.iModel.id,\n displayName: iModel.iModel.displayName,\n })),\n _links: {\n self: {\n href: \"\",\n },\n prev: null,\n next: null,\n },\n};\n\nconst mockReport: Report = {\n id: mockReportId,\n displayName: \"mOcKRePoRt1\",\n description: \"mOcKRePoRtDeScRiPtIoN1\",\n deleted: false,\n _links: {\n project: {\n href: \"\",\n },\n },\n};\n\nconst mockReportMappingsFactory = (): ReportMappingCollection => {\n return {\n mappings: [\n {\n reportId: mockReportId,\n mappingId: \"mockMappingId1\",\n imodelId: mockIModelId1,\n _links: {\n report: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n imodel: {\n href: \"\",\n },\n },\n },\n {\n reportId: mockReportId,\n mappingId: \"mockMappingId2\",\n imodelId: mockIModelId2,\n _links: {\n report: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n imodel: {\n href: \"\",\n },\n },\n },\n ],\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n };\n};\n\nconst mockMappingsFactory = (\n mockReportMappings: ReportMappingCollection\n): MappingSingle[] => {\n const mockMappings: MappingSingle[] = mockReportMappings.mappings.map(\n (mapping, index) => ({\n mapping: {\n id: mapping.mappingId,\n mappingName: `mOcKMaPpIngNaMe${index}`,\n description: `mOcKmApPInGDeScRiPtIoN${index}`,\n extractionEnabled: false,\n createdOn: \"\",\n createdBy: \"\",\n modifiedOn: \"\",\n modifiedBy: \"\",\n _links: {\n imodel: {\n // Tie the mapping to to the iModel Id\n href: mapping.imodelId,\n },\n },\n },\n })\n );\n\n return mockMappings;\n};\n\njest.mock(\"../widget/components/Constants.ts\", () => ({\n STATUS_CHECK_INTERVAL: 10,\n}));\n\njest.mock(\"../widget/components/ReportMappingHorizontalTile\", () => ({\n ReportMappingHorizontalTile: (props: ReportMappingHorizontalTileProps) => {\n return (<div data-testid=\"horizontal-tile\">\n <Text>{props.mapping.mappingName}</Text>\n <Text title={props.mapping.mappingDescription}>{props.mapping.iModelName}</Text>\n </div>);\n },\n}));\n\nlet onClose: () => Promise<void>;\njest.mock(\"../widget/components/AddMappingsModal\", () => ({\n ...jest.requireActual(\"../widget/components/AddMappingsModal\"),\n AddMappingsModal: (props: AddMappingsModalProps) => {\n onClose = props.onClose;\n return <div data-testid=\"add-mappings-modal\" />;\n },\n}));\n\njest.mock(\"@itwin/imodels-client-management\", () => ({\n ...jest.requireActual(\"@itwin/imodels-client-management\"),\n\n toArray: jest.fn().mockImplementation(async () => {\n return mockProjectIModels.iModels;\n }),\n}));\n\nconst mockGetMapping = jest.fn();\nconst mockGetMappings = jest.fn();\nconst mockGetReportMappings = jest.fn();\n\nconst mockIModelsClient = moq.Mock.ofType<IModelsClient>();\nconst mockIModelsClientOperations = moq.Mock.ofType<IModelOperations<OperationOptions>>();\nconst mockReportsClient = moq.Mock.ofType<ReportsClient>();\nconst mockMappingsClient = moq.Mock.ofType<MappingsClient>();\n\nbeforeAll(async () => {\n const localization = new EmptyLocalization();\n await ReportsConfigWidget.initialize(localization);\n mockIModelsClientOperations.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))\n .returns(async () => mockIModelsResponse[0].iModel);\n mockIModelsClientOperations.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))\n .returns(async () => mockIModelsResponse[1].iModel);\n mockIModelsClient.setup((x) => x.iModels)\n .returns(() => mockIModelsClientOperations.object);\n mockReportsClient.setup(async (x) => x.getReportMappings(moq.It.isAny(), moq.It.isAny())).returns(mockGetReportMappings);\n mockMappingsClient.setup(async (x) => x.getMappings(moq.It.isAny(), moq.It.isAny())).returns(mockGetMappings);\n mockMappingsClient.setup(async (x) => x.getMapping(moq.It.isAny(), moq.It.isAny(), moq.It.isAny())).returns(mockGetMapping);\n});\n\nafterEach(() => {\n mockGetMapping.mockReset();\n mockGetMappings.mockReset();\n mockGetReportMappings.mockReset();\n});\n\ndescribe(\"Report Mappings View\", () => {\n it(\"shows all report mappings\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const mockMappings = mockMappingsFactory(mockReportMappings);\n\n mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);\n mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);\n\n render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const horizontalTiles = screen.getAllByTestId(\"horizontal-tile\");\n assertHorizontalTiles(horizontalTiles, mockMappings);\n });\n\n it(\"search for a report mapping\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const mockMappings = mockMappingsFactory(mockReportMappings);\n\n mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);\n mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);\n\n const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const searchButton = screen.getByTestId(/rcw-search-button/i);\n\n await user.click(searchButton);\n const searchInput = screen.getByRole(\"textbox\", {\n name: /search\\-textbox/i,\n });\n\n // Be an exact match on display name.\n await user.type(searchInput, mockMappings[0].mapping.mappingName);\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(mockMappings[0].mapping.mappingName)\n ).toBeInTheDocument();\n\n // Be an exact match on description.\n await user.clear(searchInput);\n await user.type(searchInput, mockMappings[0].mapping.description ?? \"\");\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByTitle(mockMappings[0].mapping.description ?? \"\")\n ).toBeInTheDocument();\n\n // Be an exact match on iModel Name.\n const iModel = mockIModelsResponse.find(\n (mockIModel) =>\n mockIModel.iModel.id === mockMappings[0].mapping._links.imodel.href\n );\n await user.clear(searchInput);\n await user.type(searchInput, iModel?.iModel.displayName ?? \"\");\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(iModel?.iModel.displayName ?? \"\")\n ).toBeInTheDocument();\n });\n\n it(\"add mapping\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const mockMappings = mockMappingsFactory(mockReportMappings);\n\n mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);\n mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);\n\n const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n mockGetMappings.mockReturnValueOnce(mockMappings.map((m: MappingSingle) => m.mapping));\n\n const addMappingButton = screen.getByRole(\"button\", {\n name: /addmapping/i,\n });\n\n await user.click(addMappingButton);\n\n const addMappingsModal = await screen.findByTestId(\"add-mappings-modal\");\n expect(addMappingsModal).toBeInTheDocument();\n\n await act(async () => {\n await onClose();\n });\n\n const horizontalTiles = screen.getAllByTestId(\"horizontal-tile\");\n assertHorizontalTiles(horizontalTiles, mockMappings);\n\n expect(mockGetReportMappings).toBeCalledTimes(2);\n });\n\n it(\"odata feed url\", async () => {\n const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const urlTextbox = screen.getByRole(\"textbox\", {\n name: /odatafeedurl/i,\n });\n expect(urlTextbox).toBeInTheDocument();\n expect(\n screen.getByDisplayValue(\n `https://api.bentley.com/insights/reporting/odata/${mockReport.id}`\n )\n ).toBeInTheDocument();\n\n const copyButton = screen.getByRole(\"button\", {\n name: /copy/i,\n });\n\n await user.click(copyButton);\n expect(screen.getByText(/copiedtoclipboard/i)).toBeInTheDocument();\n });\n\n it(\"update all datasets\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const mockMappings = mockMappingsFactory(mockReportMappings);\n\n mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);\n mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);\n\n const iModels = mockIModelsResponse.map((iModel) => iModel.iModel.id);\n\n const bulkExtractor = new BulkExtractor(new ReportsClient(), new ExtractionClient(), jest.fn().mockResolvedValue(\"mockAccessToken\"), jest.fn, jest.fn);\n\n const runIModelExtractionsMock = jest.spyOn(bulkExtractor, \"runIModelExtractions\").mockImplementation(async () => Promise.resolve());\n\n const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object, bulkExtractor });\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const extractAllButton = screen.getByText(/UpdateAllDatasets/i);\n expect(extractAllButton).toBeInTheDocument();\n\n await user.click(extractAllButton);\n await waitFor(() => expect(extractAllButton).toBeEnabled());\n\n // Check that the mocked method was called with the expected arguments\n expect(runIModelExtractionsMock).toHaveBeenCalledWith(iModels);\n });\n\n const assertHorizontalTiles = (horizontalTiles: HTMLElement[], mockMappings: MappingSingle[]) => {\n expect(horizontalTiles).toHaveLength(mockMappings.length);\n\n for (const [index, horizontalTile] of horizontalTiles.entries()) {\n const reportMappingTile = within(horizontalTile);\n const mockiModel = mockIModelsResponse.find(\n (iModel) =>\n iModel.iModel.id === mockMappings[index].mapping._links.imodel.href\n );\n expect(\n reportMappingTile.getByText(\n mockMappings[index].mapping.mappingName\n )\n ).toBeInTheDocument();\n expect(\n reportMappingTile.getByTitle(\n mockMappings[index].mapping.description ?? \"\"\n )\n ).toBeInTheDocument();\n expect(\n reportMappingTile.getByText(mockiModel?.iModel.displayName ?? \"\")\n ).toBeInTheDocument();\n }\n };\n});\n"]}
@@ -4,19 +4,15 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import React from "react";
6
6
  import "@testing-library/jest-dom";
7
- import { render, screen, TestUtils, waitForElementToBeRemoved, within, } from "../test/test-utils";
7
+ import { render, screen, waitForElementToBeRemoved, within, } from "../test/test-utils";
8
8
  import { Reports } from "../widget/components/Reports";
9
- import { NoRenderApp } from "@itwin/core-frontend";
10
9
  import { ReportsConfigWidget } from "../ReportsConfigWidget";
11
10
  import { rest } from "msw";
12
11
  import { setupServer } from "msw/node";
13
- import * as moq from "typemoq";
14
- import { Presentation, SelectionChangeEvent, } from "@itwin/presentation-frontend";
15
12
  import faker from "@faker-js/faker";
16
13
  import userEvent from "@testing-library/user-event";
17
14
  import { REPORTS_CONFIG_BASE_URL } from "../widget/ReportsConfigUiProvider";
18
- const mockITwinId = faker.datatype.uuid();
19
- const mockIModelId = faker.datatype.uuid();
15
+ import { EmptyLocalization } from "@itwin/core-common";
20
16
  const reportsFactory = () => ({
21
17
  reports: Array.from({ length: faker.datatype.number({ min: 3, max: 5 }) }, (_, index) => ({
22
18
  id: `${faker.datatype.uuid()}`,
@@ -36,47 +32,13 @@ const reportsFactory = () => ({
36
32
  },
37
33
  },
38
34
  });
39
- const connectionMock = moq.Mock.ofType();
40
- const selectionManagerMock = moq.Mock.ofType();
41
- const selectionScopesManagerMock = moq.Mock.ofType();
42
- jest.mock("@itwin/appui-react", () => ({
43
- ...jest.requireActual("@itwin/appui-react"),
44
- useActiveIModelConnection: () => connectionMock.object,
45
- }));
46
- jest.mock("../widget/components/ReportMappings", () => ({
47
- ReportMappings: () => "MockReportMappings",
48
- }));
49
35
  const server = setupServer();
50
36
  beforeAll(async () => {
51
- // This is required by the i18n module within iTwin.js
52
- global.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; // eslint-disable-line @typescript-eslint/no-var-requires
53
- await NoRenderApp.startup();
54
- await Presentation.initialize();
55
- const selectionSet = moq.Mock.ofType();
56
- const onChanged = moq.Mock.ofType();
57
- selectionSet.setup((x) => x.elements).returns(() => new Set([]));
58
- selectionSet.setup((x) => x.onChanged).returns(() => onChanged.object);
59
- connectionMock
60
- .setup((x) => x.selectionSet)
61
- .returns(() => selectionSet.object);
62
- connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);
63
- connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);
64
- selectionManagerMock
65
- .setup((x) => x.selectionChange)
66
- .returns(() => new SelectionChangeEvent());
67
- selectionScopesManagerMock
68
- .setup(async (x) => x.getSelectionScopes(connectionMock.object))
69
- .returns(async () => []);
70
- selectionManagerMock
71
- .setup((x) => x.scopes)
72
- .returns(() => selectionScopesManagerMock.object);
73
- Presentation.setSelectionManager(selectionManagerMock.object);
74
- await TestUtils.initializeUiFramework(connectionMock.object);
75
- await ReportsConfigWidget.initialize();
37
+ const localization = new EmptyLocalization();
38
+ await ReportsConfigWidget.initialize(localization);
76
39
  server.listen();
77
40
  });
78
41
  afterAll(() => {
79
- TestUtils.terminateUiFramework();
80
42
  server.close();
81
43
  });
82
44
  afterEach(() => server.resetHandlers());
@@ -85,28 +47,29 @@ describe("Reports View", () => {
85
47
  server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
86
48
  return res(ctx.delay(500), ctx.status(200), ctx.json({ reports: [] }));
87
49
  }));
88
- const { user } = render(React.createElement(Reports, null));
50
+ const onClickAddMock = jest.fn();
51
+ const { user } = render(React.createElement(Reports, { onClickAddReport: onClickAddMock }));
89
52
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
90
53
  const ctaButton = screen.getByRole("button", {
91
54
  name: /createonereportcta/i,
92
55
  });
93
56
  await user.click(ctaButton);
94
- expect(screen.getByText(/addreport/i)).toBeInTheDocument();
57
+ expect(onClickAddMock).toBeCalled();
95
58
  });
96
59
  it("be able to add new report", async () => {
97
60
  server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
98
61
  return res(ctx.delay(500), ctx.status(200), ctx.json({ reports: [] }));
99
62
  }));
100
- const { user } = render(React.createElement(Reports, null));
63
+ const onClickAddMock = jest.fn();
64
+ const { user } = render(React.createElement(Reports, { onClickAddReport: onClickAddMock }));
101
65
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
102
66
  const newButton = screen.getByRole("button", {
103
67
  name: /new/i,
104
68
  });
105
69
  await user.click(newButton);
106
- expect(screen.getByText(/addreport/i)).toBeInTheDocument();
70
+ expect(onClickAddMock).toBeCalled();
107
71
  });
108
72
  it("list all reports", async () => {
109
- var _a, _b;
110
73
  const mockedReports = reportsFactory();
111
74
  server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
112
75
  return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));
@@ -115,11 +78,11 @@ describe("Reports View", () => {
115
78
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
116
79
  const horizontalTiles = screen.getAllByTestId("horizontal-tile");
117
80
  // TODO check for all descriptions and names and imodels
118
- expect(horizontalTiles).toHaveLength(mockedReports === null || mockedReports === void 0 ? void 0 : mockedReports.reports.length);
81
+ expect(horizontalTiles).toHaveLength(mockedReports?.reports.length);
119
82
  for (const [index, horizontalTile] of horizontalTiles.entries()) {
120
83
  const reportMappingTile = within(horizontalTile);
121
- expect(reportMappingTile.getByText((_a = mockedReports === null || mockedReports === void 0 ? void 0 : mockedReports.reports[index].displayName) !== null && _a !== void 0 ? _a : "")).toBeInTheDocument();
122
- expect(reportMappingTile.getByTitle((_b = mockedReports === null || mockedReports === void 0 ? void 0 : mockedReports.reports[index].description) !== null && _b !== void 0 ? _b : "")).toBeInTheDocument();
84
+ expect(reportMappingTile.getByText(mockedReports?.reports[index].displayName ?? "")).toBeInTheDocument();
85
+ expect(reportMappingTile.getByTitle(mockedReports?.reports[index].description ?? "")).toBeInTheDocument();
123
86
  }
124
87
  });
125
88
  it("able to modify a report", async () => {
@@ -127,13 +90,14 @@ describe("Reports View", () => {
127
90
  server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
128
91
  return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));
129
92
  }));
130
- const { user } = render(React.createElement(Reports, null));
93
+ const onClickModifyMock = jest.fn();
94
+ const { user } = render(React.createElement(Reports, { onClickReportModify: onClickModifyMock }));
131
95
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
132
96
  const firstMenuDropdown = within(screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
133
97
  await user.click(firstMenuDropdown);
134
98
  const modifyButton = screen.getByRole("menuitem", { name: /modify/i });
135
99
  await user.click(modifyButton);
136
- expect(screen.getByText(/modifyreport/i)).toBeInTheDocument();
100
+ expect(onClickModifyMock).toBeCalled();
137
101
  });
138
102
  it("remove a report", async () => {
139
103
  const mockedReports = reportsFactory();
@@ -162,14 +126,13 @@ describe("Reports View", () => {
162
126
  expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(mockedReportsOriginalLength - 1);
163
127
  });
164
128
  it("search for a report", async () => {
165
- var _a;
166
129
  const mockedReports = reportsFactory();
167
130
  server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
168
131
  return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));
169
132
  }));
170
133
  const { user } = render(React.createElement(Reports, null));
171
134
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
172
- const searchButton = within(screen.getByTestId(/rcw-search-bar/i)).getByRole("button");
135
+ const searchButton = screen.getByTestId(/rcw-search-button/i);
173
136
  await user.click(searchButton);
174
137
  const searchInput = screen.getByRole("textbox", {
175
138
  name: /search\-textbox/i,
@@ -180,7 +143,7 @@ describe("Reports View", () => {
180
143
  expect(screen.getByText(mockedReports.reports[0].displayName)).toBeInTheDocument();
181
144
  // Be an exact match on description.
182
145
  await userEvent.clear(searchInput);
183
- await userEvent.type(searchInput, (_a = mockedReports.reports[0].description) !== null && _a !== void 0 ? _a : "");
146
+ await userEvent.type(searchInput, mockedReports.reports[0].description ?? "");
184
147
  expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
185
148
  expect(screen.getByText(mockedReports.reports[0].displayName)).toBeInTheDocument();
186
149
  });
@@ -189,25 +152,26 @@ describe("Reports View", () => {
189
152
  server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
190
153
  return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));
191
154
  }));
192
- const { user } = render(React.createElement(Reports, null));
155
+ const onClickModifyMock = jest.fn();
156
+ const { user } = render(React.createElement(Reports, { onClickReportModify: onClickModifyMock }));
193
157
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
194
158
  const firstMenuDropdown = within(screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
195
159
  await user.click(firstMenuDropdown);
196
160
  const modifyButton = screen.getByRole("menuitem", { name: /modify/i });
197
161
  await user.click(modifyButton);
198
- // Modify report should appear
199
- expect(screen.getByText(/modifyreport/i)).toBeInTheDocument();
162
+ expect(onClickModifyMock).toBeCalled();
200
163
  });
201
164
  it("click a report", async () => {
202
165
  const mockedReports = reportsFactory();
203
166
  server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
204
167
  return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));
205
168
  }));
206
- const { user } = render(React.createElement(Reports, null));
169
+ const onClickTitleMock = jest.fn();
170
+ const { user } = render(React.createElement(Reports, { onClickReportTitle: onClickTitleMock }));
207
171
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
208
172
  const reportName = screen.getByText(mockedReports.reports[0].displayName);
209
173
  await user.click(reportName);
210
- expect(screen.getByText(/MockReportMappings/i)).toBeInTheDocument();
174
+ expect(onClickTitleMock).toBeCalled();
211
175
  });
212
176
  });
213
177
  //# sourceMappingURL=Reports.test.js.map