@itwin/reports-config-widget-react 0.3.0 → 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 (234) hide show
  1. package/.rush/temp/operation/rebuild/all.log +2 -2
  2. package/.rush/temp/operation/rebuild/state.json +1 -1
  3. package/.rush/temp/package-deps_rebuild.json +30 -30
  4. package/.rush/temp/shrinkwrap-deps.json +142 -175
  5. package/CHANGELOG.json +26 -0
  6. package/CHANGELOG.md +15 -1
  7. package/coverage/clover.xml +858 -0
  8. package/coverage/coverage-final.json +33 -0
  9. package/coverage/lcov-report/base.css +224 -0
  10. package/coverage/lcov-report/block-navigation.js +87 -0
  11. package/coverage/lcov-report/favicon.png +0 -0
  12. package/coverage/lcov-report/index.html +206 -0
  13. package/coverage/lcov-report/prettify.css +1 -0
  14. package/coverage/lcov-report/prettify.js +2 -0
  15. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  16. package/coverage/lcov-report/sorter.js +196 -0
  17. package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +193 -0
  18. package/coverage/lcov-report/src/index.html +116 -0
  19. package/coverage/lcov-report/src/test/index.html +116 -0
  20. package/coverage/lcov-report/src/test/test-utils.tsx.html +196 -0
  21. package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +265 -0
  22. package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +247 -0
  23. package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +589 -0
  24. package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +664 -0
  25. package/coverage/lcov-report/src/widget/components/Constants.ts.html +106 -0
  26. package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +367 -0
  27. package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +187 -0
  28. package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +145 -0
  29. package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +139 -0
  30. package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +151 -0
  31. package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +190 -0
  32. package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +176 -0
  33. package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +295 -0
  34. package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +208 -0
  35. package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +289 -0
  36. package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +262 -0
  37. package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +472 -0
  38. package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +472 -0
  39. package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +469 -0
  40. package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +1063 -0
  41. package/coverage/lcov-report/src/widget/components/Reports.tsx.html +754 -0
  42. package/coverage/lcov-report/src/widget/components/ReportsConfigContext.tsx.html +370 -0
  43. package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +301 -0
  44. package/coverage/lcov-report/src/widget/components/ReportsHeader.tsx.html +166 -0
  45. package/coverage/lcov-report/src/widget/components/ReportsRouter.tsx.html +274 -0
  46. package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +286 -0
  47. package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +337 -0
  48. package/coverage/lcov-report/src/widget/components/index.html +416 -0
  49. package/coverage/lcov-report/src/widget/components/utils.tsx.html +565 -0
  50. package/coverage/lcov-report/src/widget/context/BulkExtractorContext.tsx.html +163 -0
  51. package/coverage/lcov-report/src/widget/context/ReportsConfigApiContext.tsx.html +202 -0
  52. package/coverage/lcov-report/src/widget/context/index.html +131 -0
  53. package/coverage/lcov-report/src/widget/hooks/index.html +116 -0
  54. package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +295 -0
  55. package/coverage/lcov-report/src/widget/index.html +116 -0
  56. package/coverage/lcov.info +1596 -0
  57. package/jest.config.js +1 -0
  58. package/lib/cjs/ReportsConfigWidget.js +1 -1
  59. package/lib/cjs/ReportsConfigWidget.js.map +1 -1
  60. package/lib/cjs/test/AddMappingModal.test.js +6 -7
  61. package/lib/cjs/test/AddMappingModal.test.js.map +1 -1
  62. package/lib/cjs/test/DeleteModal.test.js +2 -2
  63. package/lib/cjs/test/DeleteModal.test.js.map +1 -1
  64. package/lib/cjs/test/ReportAction.test.js +7 -7
  65. package/lib/cjs/test/ReportAction.test.js.map +1 -1
  66. package/lib/cjs/test/ReportMappingHorizontalTile.test.js +18 -19
  67. package/lib/cjs/test/ReportMappingHorizontalTile.test.js.map +1 -1
  68. package/lib/cjs/test/ReportMappings.test.js +19 -21
  69. package/lib/cjs/test/ReportMappings.test.js.map +1 -1
  70. package/lib/cjs/test/Reports.test.js +27 -29
  71. package/lib/cjs/test/Reports.test.js.map +1 -1
  72. package/lib/cjs/test/WidgetHeader.test.js +9 -3
  73. package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
  74. package/lib/cjs/test/test-utils.js +2 -5
  75. package/lib/cjs/test/test-utils.js.map +1 -1
  76. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  77. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts +3 -3
  78. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts.map +1 -1
  79. package/lib/cjs/widget/ReportsConfigUiProvider.js +5 -7
  80. package/lib/cjs/widget/ReportsConfigUiProvider.js.map +1 -1
  81. package/lib/cjs/widget/components/ActionPanel.d.ts +2 -2
  82. package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -1
  83. package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
  84. package/lib/cjs/widget/components/ActionPanel.scss +2 -3
  85. package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
  86. package/lib/cjs/widget/components/AddMappingsModal.js +22 -27
  87. package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
  88. package/lib/cjs/widget/components/AddMappingsModal.scss +1 -2
  89. package/lib/cjs/widget/components/BulkExtractor.js +2 -2
  90. package/lib/cjs/widget/components/BulkExtractor.js.map +1 -1
  91. package/lib/cjs/widget/components/DeleteModal.js +3 -3
  92. package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
  93. package/lib/cjs/widget/components/DeleteModal.scss +2 -3
  94. package/lib/cjs/widget/components/ExtractionStatus.js +2 -2
  95. package/lib/cjs/widget/components/ExtractionStatus.js.map +1 -1
  96. package/lib/cjs/widget/components/ExtractionStatus.scss +6 -7
  97. package/lib/cjs/widget/components/HorizontalTile.js +2 -2
  98. package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
  99. package/lib/cjs/widget/components/HorizontalTile.scss +10 -16
  100. package/lib/cjs/widget/components/LocalizedTablePaginator.js +2 -2
  101. package/lib/cjs/widget/components/LocalizedTablePaginator.js.map +1 -1
  102. package/lib/cjs/widget/components/ReportAction.js +14 -16
  103. package/lib/cjs/widget/components/ReportAction.js.map +1 -1
  104. package/lib/cjs/widget/components/ReportAction.scss +1 -2
  105. package/lib/cjs/widget/components/ReportHorizontalTile.js +9 -11
  106. package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -1
  107. package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
  108. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js +17 -17
  109. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js.map +1 -1
  110. package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
  111. package/lib/cjs/widget/components/ReportMappings.js +23 -26
  112. package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
  113. package/lib/cjs/widget/components/ReportMappings.scss +9 -10
  114. package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
  115. package/lib/cjs/widget/components/Reports.js +21 -21
  116. package/lib/cjs/widget/components/Reports.js.map +1 -1
  117. package/lib/cjs/widget/components/Reports.scss +15 -15
  118. package/lib/cjs/widget/components/ReportsConfigContext.js +23 -31
  119. package/lib/cjs/widget/components/ReportsConfigContext.js.map +1 -1
  120. package/lib/cjs/widget/components/ReportsContainer.js +4 -5
  121. package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
  122. package/lib/cjs/widget/components/ReportsContainer.scss +1 -3
  123. package/lib/cjs/widget/components/ReportsRouter.js +1 -2
  124. package/lib/cjs/widget/components/ReportsRouter.js.map +1 -1
  125. package/lib/cjs/widget/components/SearchBar.d.ts.map +1 -1
  126. package/lib/cjs/widget/components/SearchBar.js +4 -4
  127. package/lib/cjs/widget/components/SearchBar.js.map +1 -1
  128. package/lib/cjs/widget/components/SearchBar.scss +0 -1
  129. package/lib/cjs/widget/components/SelectIModel.js +5 -5
  130. package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
  131. package/lib/cjs/widget/components/SelectIModel.scss +2 -3
  132. package/lib/cjs/widget/components/utils.d.ts.map +1 -1
  133. package/lib/cjs/widget/components/utils.js +1 -1
  134. package/lib/cjs/widget/components/utils.js.map +1 -1
  135. package/lib/cjs/widget/components/utils.scss +16 -8
  136. package/lib/cjs/widget/context/BulkExtractorContext.js +1 -1
  137. package/lib/cjs/widget/context/BulkExtractorContext.js.map +1 -1
  138. package/lib/cjs/widget/context/ReportsConfigApiContext.js +1 -1
  139. package/lib/cjs/widget/context/ReportsConfigApiContext.js.map +1 -1
  140. package/lib/cjs/widget/hooks/useValidator.js +1 -1
  141. package/lib/cjs/widget/hooks/useValidator.js.map +1 -1
  142. package/lib/esm/ReportsConfigWidget.js +1 -1
  143. package/lib/esm/ReportsConfigWidget.js.map +1 -1
  144. package/lib/esm/test/AddMappingModal.test.js +1 -2
  145. package/lib/esm/test/AddMappingModal.test.js.map +1 -1
  146. package/lib/esm/test/ReportMappingHorizontalTile.test.js +1 -2
  147. package/lib/esm/test/ReportMappingHorizontalTile.test.js.map +1 -1
  148. package/lib/esm/test/ReportMappings.test.js +6 -8
  149. package/lib/esm/test/ReportMappings.test.js.map +1 -1
  150. package/lib/esm/test/Reports.test.js +4 -6
  151. package/lib/esm/test/Reports.test.js.map +1 -1
  152. package/lib/esm/test/WidgetHeader.test.js +8 -2
  153. package/lib/esm/test/WidgetHeader.test.js.map +1 -1
  154. package/lib/esm/test/test-utils.js +1 -4
  155. package/lib/esm/test/test-utils.js.map +1 -1
  156. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  157. package/lib/esm/widget/ReportsConfigUiProvider.d.ts +3 -3
  158. package/lib/esm/widget/ReportsConfigUiProvider.d.ts.map +1 -1
  159. package/lib/esm/widget/ReportsConfigUiProvider.js +2 -4
  160. package/lib/esm/widget/ReportsConfigUiProvider.js.map +1 -1
  161. package/lib/esm/widget/components/ActionPanel.d.ts +2 -2
  162. package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -1
  163. package/lib/esm/widget/components/ActionPanel.js.map +1 -1
  164. package/lib/esm/widget/components/ActionPanel.scss +2 -3
  165. package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
  166. package/lib/esm/widget/components/AddMappingsModal.js +10 -15
  167. package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
  168. package/lib/esm/widget/components/AddMappingsModal.scss +1 -2
  169. package/lib/esm/widget/components/DeleteModal.js +2 -2
  170. package/lib/esm/widget/components/DeleteModal.js.map +1 -1
  171. package/lib/esm/widget/components/DeleteModal.scss +2 -3
  172. package/lib/esm/widget/components/ExtractionStatus.scss +6 -7
  173. package/lib/esm/widget/components/HorizontalTile.scss +10 -16
  174. package/lib/esm/widget/components/ReportAction.js +7 -9
  175. package/lib/esm/widget/components/ReportAction.js.map +1 -1
  176. package/lib/esm/widget/components/ReportAction.scss +1 -2
  177. package/lib/esm/widget/components/ReportHorizontalTile.js +4 -6
  178. package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -1
  179. package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
  180. package/lib/esm/widget/components/ReportMappingHorizontalTile.js +11 -11
  181. package/lib/esm/widget/components/ReportMappingHorizontalTile.js.map +1 -1
  182. package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
  183. package/lib/esm/widget/components/ReportMappings.js +7 -10
  184. package/lib/esm/widget/components/ReportMappings.js.map +1 -1
  185. package/lib/esm/widget/components/ReportMappings.scss +9 -10
  186. package/lib/esm/widget/components/Reports.d.ts.map +1 -1
  187. package/lib/esm/widget/components/Reports.js +9 -9
  188. package/lib/esm/widget/components/Reports.js.map +1 -1
  189. package/lib/esm/widget/components/Reports.scss +15 -15
  190. package/lib/esm/widget/components/ReportsConfigContext.js +19 -27
  191. package/lib/esm/widget/components/ReportsConfigContext.js.map +1 -1
  192. package/lib/esm/widget/components/ReportsContainer.js +1 -2
  193. package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
  194. package/lib/esm/widget/components/ReportsContainer.scss +1 -3
  195. package/lib/esm/widget/components/ReportsRouter.js +1 -2
  196. package/lib/esm/widget/components/ReportsRouter.js.map +1 -1
  197. package/lib/esm/widget/components/SearchBar.d.ts.map +1 -1
  198. package/lib/esm/widget/components/SearchBar.js +2 -2
  199. package/lib/esm/widget/components/SearchBar.js.map +1 -1
  200. package/lib/esm/widget/components/SearchBar.scss +0 -1
  201. package/lib/esm/widget/components/SelectIModel.scss +2 -3
  202. package/lib/esm/widget/components/utils.d.ts.map +1 -1
  203. package/lib/esm/widget/components/utils.js +2 -2
  204. package/lib/esm/widget/components/utils.js.map +1 -1
  205. package/lib/esm/widget/components/utils.scss +16 -8
  206. package/lib/public/locales/en/ReportsConfigWidget.json +4 -0
  207. package/package.json +30 -30
  208. package/public/locales/en/ReportsConfigWidget.json +4 -0
  209. package/reports-config-widget-react.build.error.log +14 -1
  210. package/reports-config-widget-react.build.log +63 -2
  211. package/src/test/WidgetHeader.test.tsx +9 -2
  212. package/src/widget/ReportsConfigUiProvider.tsx +7 -14
  213. package/src/widget/components/ActionPanel.scss +2 -3
  214. package/src/widget/components/ActionPanel.tsx +1 -1
  215. package/src/widget/components/AddMappingsModal.scss +1 -2
  216. package/src/widget/components/AddMappingsModal.tsx +16 -21
  217. package/src/widget/components/DeleteModal.scss +2 -3
  218. package/src/widget/components/DeleteModal.tsx +3 -3
  219. package/src/widget/components/ExtractionStatus.scss +6 -7
  220. package/src/widget/components/HorizontalTile.scss +10 -16
  221. package/src/widget/components/ReportAction.scss +1 -2
  222. package/src/widget/components/ReportAction.tsx +3 -3
  223. package/src/widget/components/ReportHorizontalTile.tsx +1 -1
  224. package/src/widget/components/ReportMappingHorizontalTile.tsx +28 -27
  225. package/src/widget/components/ReportMappings.scss +9 -10
  226. package/src/widget/components/ReportMappings.tsx +2 -4
  227. package/src/widget/components/Reports.scss +15 -15
  228. package/src/widget/components/Reports.tsx +25 -22
  229. package/src/widget/components/ReportsContainer.scss +1 -3
  230. package/src/widget/components/SearchBar.scss +0 -1
  231. package/src/widget/components/SearchBar.tsx +6 -1
  232. package/src/widget/components/SelectIModel.scss +2 -3
  233. package/src/widget/components/utils.scss +16 -8
  234. package/src/widget/components/utils.tsx +7 -6
@@ -233,19 +233,18 @@ describe("Report Mappings View", () => {
233
233
  const mockMappings = mockMappingsFactory(mockReportMappings);
234
234
  mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
235
235
  mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
236
- test_utils_1.render(react_1.default.createElement(ReportMappings_1.ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
237
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
236
+ (0, test_utils_1.render)(react_1.default.createElement(ReportMappings_1.ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
237
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
238
238
  const horizontalTiles = test_utils_1.screen.getAllByTestId("horizontal-tile");
239
239
  assertHorizontalTiles(horizontalTiles, mockMappings);
240
240
  });
241
241
  it("search for a report mapping", async () => {
242
- var _a, _b, _c, _d;
243
242
  const mockReportMappings = mockReportMappingsFactory();
244
243
  const mockMappings = mockMappingsFactory(mockReportMappings);
245
244
  mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
246
245
  mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
247
- const { user } = test_utils_1.render(react_1.default.createElement(ReportMappings_1.ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
248
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
246
+ const { user } = (0, test_utils_1.render)(react_1.default.createElement(ReportMappings_1.ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
247
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
249
248
  const searchButton = test_utils_1.screen.getByTestId(/rcw-search-button/i);
250
249
  await user.click(searchButton);
251
250
  const searchInput = test_utils_1.screen.getByRole("textbox", {
@@ -257,23 +256,23 @@ describe("Report Mappings View", () => {
257
256
  expect(test_utils_1.screen.getByText(mockMappings[0].mapping.mappingName)).toBeInTheDocument();
258
257
  // Be an exact match on description.
259
258
  await user.clear(searchInput);
260
- await user.type(searchInput, (_a = mockMappings[0].mapping.description) !== null && _a !== void 0 ? _a : "");
259
+ await user.type(searchInput, mockMappings[0].mapping.description ?? "");
261
260
  expect(test_utils_1.screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
262
- expect(test_utils_1.screen.getByTitle((_b = mockMappings[0].mapping.description) !== null && _b !== void 0 ? _b : "")).toBeInTheDocument();
261
+ expect(test_utils_1.screen.getByTitle(mockMappings[0].mapping.description ?? "")).toBeInTheDocument();
263
262
  // Be an exact match on iModel Name.
264
263
  const iModel = mockIModelsResponse.find((mockIModel) => mockIModel.iModel.id === mockMappings[0].mapping._links.imodel.href);
265
264
  await user.clear(searchInput);
266
- await user.type(searchInput, (_c = iModel === null || iModel === void 0 ? void 0 : iModel.iModel.displayName) !== null && _c !== void 0 ? _c : "");
265
+ await user.type(searchInput, iModel?.iModel.displayName ?? "");
267
266
  expect(test_utils_1.screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
268
- expect(test_utils_1.screen.getByText((_d = iModel === null || iModel === void 0 ? void 0 : iModel.iModel.displayName) !== null && _d !== void 0 ? _d : "")).toBeInTheDocument();
267
+ expect(test_utils_1.screen.getByText(iModel?.iModel.displayName ?? "")).toBeInTheDocument();
269
268
  });
270
269
  it("add mapping", async () => {
271
270
  const mockReportMappings = mockReportMappingsFactory();
272
271
  const mockMappings = mockMappingsFactory(mockReportMappings);
273
272
  mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
274
273
  mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
275
- const { user } = test_utils_1.render(react_1.default.createElement(ReportMappings_1.ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
276
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
274
+ const { user } = (0, test_utils_1.render)(react_1.default.createElement(ReportMappings_1.ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
275
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
277
276
  mockGetMappings.mockReturnValueOnce(mockMappings.map((m) => m.mapping));
278
277
  const addMappingButton = test_utils_1.screen.getByRole("button", {
279
278
  name: /addmapping/i,
@@ -281,7 +280,7 @@ describe("Report Mappings View", () => {
281
280
  await user.click(addMappingButton);
282
281
  const addMappingsModal = await test_utils_1.screen.findByTestId("add-mappings-modal");
283
282
  expect(addMappingsModal).toBeInTheDocument();
284
- await test_utils_1.act(async () => {
283
+ await (0, test_utils_1.act)(async () => {
285
284
  await onClose();
286
285
  });
287
286
  const horizontalTiles = test_utils_1.screen.getAllByTestId("horizontal-tile");
@@ -289,8 +288,8 @@ describe("Report Mappings View", () => {
289
288
  expect(mockGetReportMappings).toBeCalledTimes(2);
290
289
  });
291
290
  it("odata feed url", async () => {
292
- const { user } = test_utils_1.render(react_1.default.createElement(ReportMappings_1.ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
293
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
291
+ const { user } = (0, test_utils_1.render)(react_1.default.createElement(ReportMappings_1.ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
292
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
294
293
  const urlTextbox = test_utils_1.screen.getByRole("textbox", {
295
294
  name: /odatafeedurl/i,
296
295
  });
@@ -310,24 +309,23 @@ describe("Report Mappings View", () => {
310
309
  const iModels = mockIModelsResponse.map((iModel) => iModel.iModel.id);
311
310
  const bulkExtractor = new BulkExtractor_1.BulkExtractor(new insights_client_1.ReportsClient(), new insights_client_1.ExtractionClient(), jest.fn().mockResolvedValue("mockAccessToken"), jest.fn, jest.fn);
312
311
  const runIModelExtractionsMock = jest.spyOn(bulkExtractor, "runIModelExtractions").mockImplementation(async () => Promise.resolve());
313
- const { user } = test_utils_1.render(react_1.default.createElement(ReportMappings_1.ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object, bulkExtractor });
314
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
312
+ const { user } = (0, test_utils_1.render)(react_1.default.createElement(ReportMappings_1.ReportMappings, { report: mockReport, onClickClose: jest.fn() }), { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object, bulkExtractor });
313
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
315
314
  const extractAllButton = test_utils_1.screen.getByText(/UpdateAllDatasets/i);
316
315
  expect(extractAllButton).toBeInTheDocument();
317
316
  await user.click(extractAllButton);
318
- await test_utils_1.waitFor(() => expect(extractAllButton).toBeEnabled());
317
+ await (0, test_utils_1.waitFor)(() => expect(extractAllButton).toBeEnabled());
319
318
  // Check that the mocked method was called with the expected arguments
320
319
  expect(runIModelExtractionsMock).toHaveBeenCalledWith(iModels);
321
320
  });
322
321
  const assertHorizontalTiles = (horizontalTiles, mockMappings) => {
323
- var _a, _b;
324
322
  expect(horizontalTiles).toHaveLength(mockMappings.length);
325
323
  for (const [index, horizontalTile] of horizontalTiles.entries()) {
326
- const reportMappingTile = test_utils_1.within(horizontalTile);
324
+ const reportMappingTile = (0, test_utils_1.within)(horizontalTile);
327
325
  const mockiModel = mockIModelsResponse.find((iModel) => iModel.iModel.id === mockMappings[index].mapping._links.imodel.href);
328
326
  expect(reportMappingTile.getByText(mockMappings[index].mapping.mappingName)).toBeInTheDocument();
329
- expect(reportMappingTile.getByTitle((_a = mockMappings[index].mapping.description) !== null && _a !== void 0 ? _a : "")).toBeInTheDocument();
330
- expect(reportMappingTile.getByText((_b = mockiModel === null || mockiModel === void 0 ? void 0 : mockiModel.iModel.displayName) !== null && _b !== void 0 ? _b : "")).toBeInTheDocument();
327
+ expect(reportMappingTile.getByTitle(mockMappings[index].mapping.description ?? "")).toBeInTheDocument();
328
+ expect(reportMappingTile.getByText(mockiModel?.iModel.displayName ?? "")).toBeInTheDocument();
331
329
  }
332
330
  };
333
331
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ReportMappings.test.js","sourceRoot":"","sources":["../../../src/test/ReportMappings.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,gEAA6D;AAC7D,6CAQsB;AACtB,6CAA+B;AAO/B,4DAGgC;AAChC,wEAAqE;AAErE,gFAA+D;AAC/D,sEAAmE;AAEnE,wDAA4C;AAC5C,oDAAuD;AAGvD,sCAAsC;AACtC,MAAM,aAAa,GAAG,eAAe,CAAC;AACtC,MAAM,aAAa,GAAG,eAAe,CAAC;AAEtC,MAAM,YAAY,GAAG,cAAc,CAAC;AAEpC,MAAM,mBAAmB,GAAG;IAC1B;QACE,MAAM,EAAE;YACN,EAAE,EAAE,aAAa;YACjB,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,oBAAoB;YACjC,eAAe,EAAE,0BAA0B;YAC3C,KAAK,EAAE,uCAAW,CAAC,WAAW;YAC9B,SAAS,EAAE,wBAAW;YACtB,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE;gBACN,OAAO,EAAE;oBACP,IAAI,EAAE,EAAE;iBACT;gBACD,aAAa,EAAE;oBACb,IAAI,EAAE,EAAE;iBACT;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,EAAE;iBACT;aACF;SACF;KACF;IACD;QACE,MAAM,EAAE;YACN,EAAE,EAAE,aAAa;YACjB,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,oBAAoB;YACjC,eAAe,EAAE,0BAA0B;YAC3C,KAAK,EAAE,uCAAW,CAAC,WAAW;YAC9B,SAAS,EAAE,wBAAW;YACtB,MAAM,EA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AC,iBAAiB,EAAE,CAAC;YACtB,MAAM,CACJ,iBAAiB,CAAC,SAAS,CAAC,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,CAAC,WAAW,mCAAI,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"]}
1
+ {"version":3,"file":"ReportMappings.test.js","sourceRoot":"","sources":["../../../src/test/ReportMappings.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,gEAA6D;AAC7D,6CAQsB;AACtB,6CAA+B;AAO/B,4DAGgC;AAChC,wEAAqE;AAErE,gFAA+D;AAC/D,sEAAmE;AAEnE,wDAA4C;AAC5C,oDAAuD;AAGvD,sCAAsC;AACtC,MAAM,aAAa,GAAG,eAAe,CAAC;AACtC,MAAM,aAAa,GAAG,eAAe,CAAC;AAEtC,MAAM,YAAY,GAAG,cAAc,CAAC;AAEpC,MAAM,mBAAmB,GAAG;IAC1B;QACE,MAAM,EAAE;YACN,EAAE,EAAE,aAAa;YACjB,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,oBAAoB;YACjC,eAAe,EAAE,0BAA0B;YAC3C,KAAK,EAAE,uCAAW,CAAC,WAAW;YAC9B,SAAS,EAAE,wBAAW;YACtB,MAAM,EAAE,IAAI;YACZ,MAA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AE,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"]}
@@ -37,7 +37,7 @@ const reportsFactory = () => ({
37
37
  },
38
38
  },
39
39
  });
40
- const server = node_1.setupServer();
40
+ const server = (0, node_1.setupServer)();
41
41
  beforeAll(async () => {
42
42
  const localization = new core_common_1.EmptyLocalization();
43
43
  await ReportsConfigWidget_1.ReportsConfigWidget.initialize(localization);
@@ -53,8 +53,8 @@ describe("Reports View", () => {
53
53
  return res(ctx.delay(500), ctx.status(200), ctx.json({ reports: [] }));
54
54
  }));
55
55
  const onClickAddMock = jest.fn();
56
- const { user } = test_utils_1.render(react_1.default.createElement(Reports_1.Reports, { onClickAddReport: onClickAddMock }));
57
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
56
+ const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, { onClickAddReport: onClickAddMock }));
57
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
58
58
  const ctaButton = test_utils_1.screen.getByRole("button", {
59
59
  name: /createonereportcta/i,
60
60
  });
@@ -66,8 +66,8 @@ describe("Reports View", () => {
66
66
  return res(ctx.delay(500), ctx.status(200), ctx.json({ reports: [] }));
67
67
  }));
68
68
  const onClickAddMock = jest.fn();
69
- const { user } = test_utils_1.render(react_1.default.createElement(Reports_1.Reports, { onClickAddReport: onClickAddMock }));
70
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
69
+ const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, { onClickAddReport: onClickAddMock }));
70
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
71
71
  const newButton = test_utils_1.screen.getByRole("button", {
72
72
  name: /new/i,
73
73
  });
@@ -75,20 +75,19 @@ describe("Reports View", () => {
75
75
  expect(onClickAddMock).toBeCalled();
76
76
  });
77
77
  it("list all reports", async () => {
78
- var _a, _b;
79
78
  const mockedReports = reportsFactory();
80
79
  server.use(msw_1.rest.get(`${ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
81
80
  return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));
82
81
  }));
83
- test_utils_1.render(react_1.default.createElement(Reports_1.Reports, null));
84
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
82
+ (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, null));
83
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
85
84
  const horizontalTiles = test_utils_1.screen.getAllByTestId("horizontal-tile");
86
85
  // TODO check for all descriptions and names and imodels
87
- expect(horizontalTiles).toHaveLength(mockedReports === null || mockedReports === void 0 ? void 0 : mockedReports.reports.length);
86
+ expect(horizontalTiles).toHaveLength(mockedReports?.reports.length);
88
87
  for (const [index, horizontalTile] of horizontalTiles.entries()) {
89
- const reportMappingTile = test_utils_1.within(horizontalTile);
90
- expect(reportMappingTile.getByText((_a = mockedReports === null || mockedReports === void 0 ? void 0 : mockedReports.reports[index].displayName) !== null && _a !== void 0 ? _a : "")).toBeInTheDocument();
91
- expect(reportMappingTile.getByTitle((_b = mockedReports === null || mockedReports === void 0 ? void 0 : mockedReports.reports[index].description) !== null && _b !== void 0 ? _b : "")).toBeInTheDocument();
88
+ const reportMappingTile = (0, test_utils_1.within)(horizontalTile);
89
+ expect(reportMappingTile.getByText(mockedReports?.reports[index].displayName ?? "")).toBeInTheDocument();
90
+ expect(reportMappingTile.getByTitle(mockedReports?.reports[index].description ?? "")).toBeInTheDocument();
92
91
  }
93
92
  });
94
93
  it("able to modify a report", async () => {
@@ -97,9 +96,9 @@ describe("Reports View", () => {
97
96
  return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));
98
97
  }));
99
98
  const onClickModifyMock = jest.fn();
100
- const { user } = test_utils_1.render(react_1.default.createElement(Reports_1.Reports, { onClickReportModify: onClickModifyMock }));
101
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
102
- const firstMenuDropdown = test_utils_1.within(test_utils_1.screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
99
+ const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, { onClickReportModify: onClickModifyMock }));
100
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
101
+ const firstMenuDropdown = (0, test_utils_1.within)(test_utils_1.screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
103
102
  await user.click(firstMenuDropdown);
104
103
  const modifyButton = test_utils_1.screen.getByRole("menuitem", { name: /modify/i });
105
104
  await user.click(modifyButton);
@@ -114,9 +113,9 @@ describe("Reports View", () => {
114
113
  mockedReports.reports = mockedReports.reports.filter((report) => report.id !== mockedReports.reports[0].id);
115
114
  return res(ctx.delay(100), ctx.status(204));
116
115
  }));
117
- const { user } = test_utils_1.render(react_1.default.createElement(Reports_1.Reports, null));
118
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
119
- const firstMenuDropdown = test_utils_1.within(test_utils_1.screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
116
+ const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, null));
117
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
118
+ const firstMenuDropdown = (0, test_utils_1.within)(test_utils_1.screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
120
119
  await user.click(firstMenuDropdown);
121
120
  const removeButton = test_utils_1.screen.getByRole("menuitem", { name: /remove/i });
122
121
  await user.click(removeButton);
@@ -126,19 +125,18 @@ describe("Reports View", () => {
126
125
  name: /delete/i,
127
126
  });
128
127
  await user.click(deleteButton);
129
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByTestId(/rcw-loading-delete/i));
130
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByRole("dialog"));
128
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByTestId(/rcw-loading-delete/i));
129
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByRole("dialog"));
131
130
  // Should be one less report
132
131
  expect(test_utils_1.screen.getAllByTestId("horizontal-tile")).toHaveLength(mockedReportsOriginalLength - 1);
133
132
  });
134
133
  it("search for a report", async () => {
135
- var _a;
136
134
  const mockedReports = reportsFactory();
137
135
  server.use(msw_1.rest.get(`${ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
138
136
  return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));
139
137
  }));
140
- const { user } = test_utils_1.render(react_1.default.createElement(Reports_1.Reports, null));
141
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
138
+ const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, null));
139
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
142
140
  const searchButton = test_utils_1.screen.getByTestId(/rcw-search-button/i);
143
141
  await user.click(searchButton);
144
142
  const searchInput = test_utils_1.screen.getByRole("textbox", {
@@ -150,7 +148,7 @@ describe("Reports View", () => {
150
148
  expect(test_utils_1.screen.getByText(mockedReports.reports[0].displayName)).toBeInTheDocument();
151
149
  // Be an exact match on description.
152
150
  await user_event_1.default.clear(searchInput);
153
- await user_event_1.default.type(searchInput, (_a = mockedReports.reports[0].description) !== null && _a !== void 0 ? _a : "");
151
+ await user_event_1.default.type(searchInput, mockedReports.reports[0].description ?? "");
154
152
  expect(test_utils_1.screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
155
153
  expect(test_utils_1.screen.getByText(mockedReports.reports[0].displayName)).toBeInTheDocument();
156
154
  });
@@ -160,9 +158,9 @@ describe("Reports View", () => {
160
158
  return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));
161
159
  }));
162
160
  const onClickModifyMock = jest.fn();
163
- const { user } = test_utils_1.render(react_1.default.createElement(Reports_1.Reports, { onClickReportModify: onClickModifyMock }));
164
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
165
- const firstMenuDropdown = test_utils_1.within(test_utils_1.screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
161
+ const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, { onClickReportModify: onClickModifyMock }));
162
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
163
+ const firstMenuDropdown = (0, test_utils_1.within)(test_utils_1.screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
166
164
  await user.click(firstMenuDropdown);
167
165
  const modifyButton = test_utils_1.screen.getByRole("menuitem", { name: /modify/i });
168
166
  await user.click(modifyButton);
@@ -174,8 +172,8 @@ describe("Reports View", () => {
174
172
  return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));
175
173
  }));
176
174
  const onClickTitleMock = jest.fn();
177
- const { user } = test_utils_1.render(react_1.default.createElement(Reports_1.Reports, { onClickReportTitle: onClickTitleMock }));
178
- await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
175
+ const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, { onClickReportTitle: onClickTitleMock }));
176
+ await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
179
177
  const reportName = test_utils_1.screen.getByText(mockedReports.reports[0].displayName);
180
178
  await user.click(reportName);
181
179
  expect(onClickTitleMock).toBeCalled();
@@ -1 +1 @@
1
- {"version":3,"file":"Reports.test.js","sourceRoot":"","sources":["../../../src/test/Reports.test.tsx"],"names":[],"mappings":";;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,mDAK4B;AAC5B,0DAAuD;AACvD,gEAA6D;AAC7D,6BAA2B;AAC3B,mCAAuC;AACvC,4DAAoC;AAEpC,6EAAoD;AACpD,+EAA4E;AAC5E,oDAAuD;AAEvD,MAAM,cAAc,GAAG,GAAqB,EAAE,CAAC,CAAC;IAC9C,OAAO,EAAE,KAAK,CAAC,IAAI,CACjB,EAAE,MAAM,EAAE,eAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EACrD,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACb,EAAE,E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AC9B,MAAM,aAAa,GAAqB,cAAc,EAAE,CAAC;QACzD,MAAM,CAAC,GAAG,CACR,UAAI,CAAC,GAAG,CACN,GAAG,iDAAuB,6BAA6B,EACvD,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;YACvB,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QACvE,CAAC,CACF,CACF,CAAC;QACF,MAAM,gBAAgB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,mBAAM,CAAC,8BAAC,iBAAO,IAAC,kBAAkB,EAAE,gBAAgB,GAAI,CAAC,CAAC;QAE3E,MAAM,sCAAyB,CAAC,GAAG,EAAE,CAAC,mBAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QAEpE,MAAM,UAAU,GAAG,mBAAM,CAAC,SAAS,CACjC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CACrC,CAAC;QACF,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC7B,MAAM,CAAC,gBAAgB,CAAC,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,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 {\n render,\n screen,\n waitForElementToBeRemoved,\n within,\n} from \"../test/test-utils\";\nimport { Reports } from \"../widget/components/Reports\";\nimport { ReportsConfigWidget } from \"../ReportsConfigWidget\";\nimport { rest } from \"msw\";\nimport { setupServer } from \"msw/node\";\nimport faker from \"@faker-js/faker\";\nimport type { ReportCollection } from \"@itwin/insights-client\";\nimport userEvent from \"@testing-library/user-event\";\nimport { REPORTS_CONFIG_BASE_URL } from \"../widget/ReportsConfigUiProvider\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\n\nconst reportsFactory = (): ReportCollection => ({\n reports: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n displayName: `mOcKRePoRT${index}`,\n description: `mOcKRePoRTDeScRiPtIoN${index}`,\n deleted: false,\n _links: {\n project: {\n href: \"\",\n },\n },\n })\n ),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n});\n\nconst server = setupServer();\n\nbeforeAll(async () => {\n const localization = new EmptyLocalization();\n await ReportsConfigWidget.initialize(localization);\n server.listen();\n});\n\nafterAll(() => {\n server.close();\n});\n\nafterEach(() => server.resetHandlers());\n\ndescribe(\"Reports View\", () => {\n it(\"call to action button should be clickable with no reports\", async () => {\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(500),\n ctx.status(200),\n ctx.json({ reports: [] })\n );\n }\n )\n );\n\n const onClickAddMock = jest.fn();\n\n const { user } = render(<Reports onClickAddReport={onClickAddMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const ctaButton = screen.getByRole(\"button\", {\n name: /createonereportcta/i,\n });\n await user.click(ctaButton);\n expect(onClickAddMock).toBeCalled();\n });\n\n it(\"be able to add new report\", async () => {\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(500),\n ctx.status(200),\n ctx.json({ reports: [] })\n );\n }\n )\n );\n\n const onClickAddMock = jest.fn();\n const { user } = render(<Reports onClickAddReport={onClickAddMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const newButton = screen.getByRole(\"button\", {\n name: /new/i,\n });\n await user.click(newButton);\n expect(onClickAddMock).toBeCalled();\n });\n\n it(\"list all reports\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n\n render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const horizontalTiles = screen.getAllByTestId(\"horizontal-tile\");\n // TODO check for all descriptions and names and imodels\n expect(horizontalTiles).toHaveLength(mockedReports?.reports.length);\n\n for (const [index, horizontalTile] of horizontalTiles.entries()) {\n const reportMappingTile = within(horizontalTile);\n expect(\n reportMappingTile.getByText(\n mockedReports?.reports[index].displayName ?? \"\"\n )\n ).toBeInTheDocument();\n expect(\n reportMappingTile.getByTitle(\n mockedReports?.reports[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n }\n });\n\n it(\"able to modify a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n const onClickModifyMock = jest.fn();\n const { user } = render(<Reports onClickReportModify={onClickModifyMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const modifyButton = screen.getByRole(\"menuitem\", { name: /modify/i });\n await user.click(modifyButton);\n\n expect(onClickModifyMock).toBeCalled();\n });\n\n it(\"remove a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n const mockedReportsOriginalLength = mockedReports.reports.length;\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n ),\n rest.delete(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockedReports.reports[0].id\n }`,\n async (_req, res, ctx) => {\n mockedReports.reports = mockedReports.reports.filter(\n (report) => report.id !== mockedReports.reports[0].id\n );\n return res(ctx.delay(100), ctx.status(204));\n }\n )\n );\n\n const { user } = render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const removeButton = screen.getByRole(\"menuitem\", { name: /remove/i });\n await user.click(removeButton);\n // Delete modal dialog should appear\n expect(screen.getByRole(\"dialog\")).toBeInTheDocument();\n\n const deleteButton = screen.getByRole(\"button\", {\n name: /delete/i,\n });\n\n await user.click(deleteButton);\n\n await waitForElementToBeRemoved(() =>\n screen.getByTestId(/rcw-loading-delete/i)\n );\n await waitForElementToBeRemoved(() => screen.getByRole(\"dialog\"));\n\n // Should be one less report\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(\n mockedReportsOriginalLength - 1\n );\n });\n\n it(\"search for a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n\n const { user } = render(<Reports />);\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 userEvent.type(\n searchInput,\n mockedReports.reports[0].displayName\n );\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(mockedReports.reports[0].displayName)\n ).toBeInTheDocument();\n\n // Be an exact match on description.\n await userEvent.clear(searchInput);\n await userEvent.type(\n searchInput,\n mockedReports.reports[0].description ?? \"\"\n );\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(mockedReports.reports[0].displayName)\n ).toBeInTheDocument();\n });\n\n it(\"modify a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n const onClickModifyMock = jest.fn();\n const { user } = render(<Reports onClickReportModify={onClickModifyMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const modifyButton = screen.getByRole(\"menuitem\", { name: /modify/i });\n await user.click(modifyButton);\n expect(onClickModifyMock).toBeCalled();\n });\n\n it(\"click a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n const onClickTitleMock = jest.fn();\n const { user } = render(<Reports onClickReportTitle={onClickTitleMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const reportName = screen.getByText(\n mockedReports.reports[0].displayName\n );\n await user.click(reportName);\n expect(onClickTitleMock).toBeCalled();\n });\n});\n"]}
1
+ {"version":3,"file":"Reports.test.js","sourceRoot":"","sources":["../../../src/test/Reports.test.tsx"],"names":[],"mappings":";;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,mDAK4B;AAC5B,0DAAuD;AACvD,gEAA6D;AAC7D,6BAA2B;AAC3B,mCAAuC;AACvC,4DAAoC;AAEpC,6EAAoD;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ACL,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 {\n render,\n screen,\n waitForElementToBeRemoved,\n within,\n} from \"../test/test-utils\";\nimport { Reports } from \"../widget/components/Reports\";\nimport { ReportsConfigWidget } from \"../ReportsConfigWidget\";\nimport { rest } from \"msw\";\nimport { setupServer } from \"msw/node\";\nimport faker from \"@faker-js/faker\";\nimport type { ReportCollection } from \"@itwin/insights-client\";\nimport userEvent from \"@testing-library/user-event\";\nimport { REPORTS_CONFIG_BASE_URL } from \"../widget/ReportsConfigUiProvider\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\n\nconst reportsFactory = (): ReportCollection => ({\n reports: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n displayName: `mOcKRePoRT${index}`,\n description: `mOcKRePoRTDeScRiPtIoN${index}`,\n deleted: false,\n _links: {\n project: {\n href: \"\",\n },\n },\n })\n ),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n});\n\nconst server = setupServer();\n\nbeforeAll(async () => {\n const localization = new EmptyLocalization();\n await ReportsConfigWidget.initialize(localization);\n server.listen();\n});\n\nafterAll(() => {\n server.close();\n});\n\nafterEach(() => server.resetHandlers());\n\ndescribe(\"Reports View\", () => {\n it(\"call to action button should be clickable with no reports\", async () => {\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(500),\n ctx.status(200),\n ctx.json({ reports: [] })\n );\n }\n )\n );\n\n const onClickAddMock = jest.fn();\n\n const { user } = render(<Reports onClickAddReport={onClickAddMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const ctaButton = screen.getByRole(\"button\", {\n name: /createonereportcta/i,\n });\n await user.click(ctaButton);\n expect(onClickAddMock).toBeCalled();\n });\n\n it(\"be able to add new report\", async () => {\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(500),\n ctx.status(200),\n ctx.json({ reports: [] })\n );\n }\n )\n );\n\n const onClickAddMock = jest.fn();\n const { user } = render(<Reports onClickAddReport={onClickAddMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const newButton = screen.getByRole(\"button\", {\n name: /new/i,\n });\n await user.click(newButton);\n expect(onClickAddMock).toBeCalled();\n });\n\n it(\"list all reports\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n\n render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const horizontalTiles = screen.getAllByTestId(\"horizontal-tile\");\n // TODO check for all descriptions and names and imodels\n expect(horizontalTiles).toHaveLength(mockedReports?.reports.length);\n\n for (const [index, horizontalTile] of horizontalTiles.entries()) {\n const reportMappingTile = within(horizontalTile);\n expect(\n reportMappingTile.getByText(\n mockedReports?.reports[index].displayName ?? \"\"\n )\n ).toBeInTheDocument();\n expect(\n reportMappingTile.getByTitle(\n mockedReports?.reports[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n }\n });\n\n it(\"able to modify a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n const onClickModifyMock = jest.fn();\n const { user } = render(<Reports onClickReportModify={onClickModifyMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const modifyButton = screen.getByRole(\"menuitem\", { name: /modify/i });\n await user.click(modifyButton);\n\n expect(onClickModifyMock).toBeCalled();\n });\n\n it(\"remove a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n const mockedReportsOriginalLength = mockedReports.reports.length;\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n ),\n rest.delete(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockedReports.reports[0].id\n }`,\n async (_req, res, ctx) => {\n mockedReports.reports = mockedReports.reports.filter(\n (report) => report.id !== mockedReports.reports[0].id\n );\n return res(ctx.delay(100), ctx.status(204));\n }\n )\n );\n\n const { user } = render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const removeButton = screen.getByRole(\"menuitem\", { name: /remove/i });\n await user.click(removeButton);\n // Delete modal dialog should appear\n expect(screen.getByRole(\"dialog\")).toBeInTheDocument();\n\n const deleteButton = screen.getByRole(\"button\", {\n name: /delete/i,\n });\n\n await user.click(deleteButton);\n\n await waitForElementToBeRemoved(() =>\n screen.getByTestId(/rcw-loading-delete/i)\n );\n await waitForElementToBeRemoved(() => screen.getByRole(\"dialog\"));\n\n // Should be one less report\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(\n mockedReportsOriginalLength - 1\n );\n });\n\n it(\"search for a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n\n const { user } = render(<Reports />);\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 userEvent.type(\n searchInput,\n mockedReports.reports[0].displayName\n );\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(mockedReports.reports[0].displayName)\n ).toBeInTheDocument();\n\n // Be an exact match on description.\n await userEvent.clear(searchInput);\n await userEvent.type(\n searchInput,\n mockedReports.reports[0].description ?? \"\"\n );\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(mockedReports.reports[0].displayName)\n ).toBeInTheDocument();\n });\n\n it(\"modify a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n const onClickModifyMock = jest.fn();\n const { user } = render(<Reports onClickReportModify={onClickModifyMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const modifyButton = screen.getByRole(\"menuitem\", { name: /modify/i });\n await user.click(modifyButton);\n expect(onClickModifyMock).toBeCalled();\n });\n\n it(\"click a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n const onClickTitleMock = jest.fn();\n const { user } = render(<Reports onClickReportTitle={onClickTitleMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const reportName = screen.getByText(\n mockedReports.reports[0].displayName\n );\n await user.click(reportName);\n expect(onClickTitleMock).toBeCalled();\n });\n});\n"]}
@@ -12,17 +12,23 @@ require("@testing-library/jest-dom");
12
12
  const test_utils_1 = require("../test/test-utils");
13
13
  const utils_1 = require("../widget/components/utils");
14
14
  const faker_1 = require("@faker-js/faker");
15
+ const core_common_1 = require("@itwin/core-common");
16
+ const ReportsConfigWidget_1 = require("../ReportsConfigWidget");
15
17
  describe("Widget Header Component", () => {
18
+ beforeAll(async () => {
19
+ const localization = new core_common_1.EmptyLocalization();
20
+ await ReportsConfigWidget_1.ReportsConfigWidget.initialize(localization);
21
+ });
16
22
  it("title renders", async () => {
17
23
  const fakeTitle = faker_1.faker.word.interjection();
18
- test_utils_1.render(react_1.default.createElement(utils_1.WidgetHeader, { title: fakeTitle }));
24
+ (0, test_utils_1.render)(react_1.default.createElement(utils_1.WidgetHeader, { title: fakeTitle }));
19
25
  const title = test_utils_1.screen.getByText(fakeTitle);
20
26
  expect(title).toHaveTextContent(fakeTitle);
21
27
  });
22
28
  it("header allows return callback", async () => {
23
29
  const mockReturnFn = jest.fn();
24
- const { user } = test_utils_1.render(react_1.default.createElement(utils_1.WidgetHeader, { title: "", returnFn: mockReturnFn }));
25
- const returnBtn = test_utils_1.screen.getByRole("button");
30
+ const { user, container } = (0, test_utils_1.render)(react_1.default.createElement(utils_1.WidgetHeader, { title: "", returnFn: mockReturnFn }));
31
+ const returnBtn = container.getElementsByClassName("rcw-chevron")[0];
26
32
  await user.click(returnBtn);
27
33
  expect(mockReturnFn).toHaveBeenCalledTimes(1);
28
34
  });
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetHeader.test.js","sourceRoot":"","sources":["../../../src/test/WidgetHeader.test.tsx"],"names":[],"mappings":";;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,mDAAoD;AACpD,sDAA0D;AAC1D,2CAAwC;AAExC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,SAAS,GAAG,aAAK,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAC5C,mBAAM,CAAC,8BAAC,oBAAY,IAAC,KAAK,EAAE,SAAS,GAAI,CAAC,CAAC;QAE3C,MAAM,KAAK,GAAG,mBAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAE1C,MAAM,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,mBAAM,CAAC,8BAAC,oBAAY,IAAC,KAAK,EAAC,EAAE,EAAC,QAAQ,EAAE,YAAY,GAAI,CAAC,CAAC;QAE3E,MAAM,SAAS,GAAG,mBAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5B,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,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 { render, screen } from \"../test/test-utils\";\nimport { WidgetHeader } from \"../widget/components/utils\";\nimport { faker } from \"@faker-js/faker\";\n\ndescribe(\"Widget Header Component\", () => {\n it(\"title renders\", async () => {\n const fakeTitle = faker.word.interjection();\n render(<WidgetHeader title={fakeTitle} />);\n\n const title = screen.getByText(fakeTitle);\n\n expect(title).toHaveTextContent(fakeTitle);\n });\n\n it(\"header allows return callback\", async () => {\n const mockReturnFn = jest.fn();\n const { user } = render(<WidgetHeader title=\"\" returnFn={mockReturnFn} />);\n\n const returnBtn = screen.getByRole(\"button\");\n await user.click(returnBtn);\n expect(mockReturnFn).toHaveBeenCalledTimes(1);\n });\n});\n"]}
1
+ {"version":3,"file":"WidgetHeader.test.js","sourceRoot":"","sources":["../../../src/test/WidgetHeader.test.tsx"],"names":[],"mappings":";;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,mDAAoD;AACpD,sDAA0D;AAC1D,2CAAwC;AACxC,oDAAuD;AACvD,gEAA6D;AAE7D,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,YAAY,GAAG,IAAI,+BAAiB,EAAE,CAAC;QAC7C,MAAM,yCAAmB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,SAAS,GAAG,aAAK,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAC5C,IAAA,mBAAM,EAAC,8BAAC,oBAAY,IAAC,KAAK,EAAE,SAAS,GAAI,CAAC,CAAC;QAE3C,MAAM,KAAK,GAAG,mBAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAE1C,MAAM,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC/B,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAA,mBAAM,EAAC,8BAAC,oBAAY,IAAC,KAAK,EAAC,EAAE,EAAC,QAAQ,EAAE,YAAY,GAAI,CAAC,CAAC;QAEtF,MAAM,SAAS,GAAG,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5B,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,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 { render, screen } from \"../test/test-utils\";\nimport { WidgetHeader } from \"../widget/components/utils\";\nimport { faker } from \"@faker-js/faker\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\nimport { ReportsConfigWidget } from \"../ReportsConfigWidget\";\n\ndescribe(\"Widget Header Component\", () => {\n beforeAll(async () => {\n const localization = new EmptyLocalization();\n await ReportsConfigWidget.initialize(localization);\n });\n\n it(\"title renders\", async () => {\n const fakeTitle = faker.word.interjection();\n render(<WidgetHeader title={fakeTitle} />);\n\n const title = screen.getByText(fakeTitle);\n\n expect(title).toHaveTextContent(fakeTitle);\n });\n\n it(\"header allows return callback\", async () => {\n const mockReturnFn = jest.fn();\n const { user, container } = render(<WidgetHeader title=\"\" returnFn={mockReturnFn} />);\n\n const returnBtn = container.getElementsByClassName(\"rcw-chevron\")[0];\n await user.click(returnBtn);\n expect(mockReturnFn).toHaveBeenCalledTimes(1);\n });\n});\n"]}
@@ -38,13 +38,10 @@ const mockAccessToken = async () => "Bearer eyJhbGci";
38
38
  exports.mockAccessToken = mockAccessToken;
39
39
  exports.mockITwinId = "mockiTwinId";
40
40
  function render(ui, contextProps, { ...options } = {}) {
41
- const Wrapper = ({ children }) => {
42
- var _a;
43
- return (React.createElement(ReportsConfigContext_1.ReportsConfigContext, { getAccessToken: exports.mockAccessToken, iTwinId: (_a = contextProps === null || contextProps === void 0 ? void 0 : contextProps.iTwinId) !== null && _a !== void 0 ? _a : exports.mockITwinId, ...contextProps }, children));
44
- };
41
+ const Wrapper = ({ children }) => (React.createElement(ReportsConfigContext_1.ReportsConfigContext, { getAccessToken: exports.mockAccessToken, iTwinId: contextProps?.iTwinId ?? exports.mockITwinId, ...contextProps }, children));
45
42
  return {
46
43
  user: user_event_1.default.setup(),
47
- ...react_1.render(ui, { wrapper: Wrapper, ...options }),
44
+ ...(0, react_1.render)(ui, { wrapper: Wrapper, ...options }),
48
45
  };
49
46
  }
50
47
  exports.render = render;
@@ -1 +1 @@
1
- {"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../../src/test/test-utils.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAC/B,kDAA6D;AAC7D,6EAAoD;AAEpD,oFAAiF;AAE1E,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE,CAAC,iBAAiB,CAAC;AAAhD,QAAA,eAAe,mBAAiC;AAKhD,QAAA,WAAW,GAAW,aAAa,CAAC;AAEjD,SAAS,MAAM,CAAC,EAAsB,EAAE,YAAiD,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE;IAC5G,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAgB,EAAE,EAAE;;QAAC,OAAA,CAC9C,oBAAC,2CAAoB,IACnB,cAAc,EAAE,uBAAe,EAC/B,OAAO,EAAE,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,mCAAI,mBAAW,KACzC,YAAY,IAEf,QAAQ,CACY,CACxB,CAAA;KAAA,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,oBAAS,CAAC,KAAK,EAAE;QACvB,GAAG,cAAS,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;KACnD,CAAC;AACJ,CAAC;AAIQ,wBAAM;AAFf,yDAAuC","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 * as React from \"react\";\nimport { render as rtlRender } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport type { ReportsConfigContextProps } from \"../widget/components/ReportsConfigContext\";\nimport { ReportsConfigContext } from \"../widget/components/ReportsConfigContext\";\n\nexport const mockAccessToken = async () => \"Bearer eyJhbGci\";\n\ninterface WrapperProps {\n children?: React.ReactNode;\n}\nexport const mockITwinId: string = \"mockiTwinId\";\n\nfunction render(ui: React.ReactElement, contextProps?: Partial<ReportsConfigContextProps>, { ...options } = {}) {\n const Wrapper = ({ children }: WrapperProps) => (\n <ReportsConfigContext\n getAccessToken={mockAccessToken}\n iTwinId={contextProps?.iTwinId ?? mockITwinId}\n {...contextProps}\n >\n {children}\n </ReportsConfigContext>\n );\n\n return {\n user: userEvent.setup(),\n ...rtlRender(ui, { wrapper: Wrapper, ...options }),\n };\n}\n\nexport * from \"@testing-library/react\";\n// override React Testing Library's render with our own\nexport { render };\n"]}
1
+ {"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../../src/test/test-utils.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAC/B,kDAA6D;AAC7D,6EAAoD;AAEpD,oFAAiF;AAE1E,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE,CAAC,iBAAiB,CAAC;AAAhD,QAAA,eAAe,mBAAiC;AAKhD,QAAA,WAAW,GAAW,aAAa,CAAC;AAEjD,SAAS,MAAM,CAAC,EAAsB,EAAE,YAAiD,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE;IAC5G,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAgB,EAAE,EAAE,CAAC,CAC9C,oBAAC,2CAAoB,IACnB,cAAc,EAAE,uBAAe,EAC/B,OAAO,EAAE,YAAY,EAAE,OAAO,IAAI,mBAAW,KACzC,YAAY,IAEf,QAAQ,CACY,CACxB,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,oBAAS,CAAC,KAAK,EAAE;QACvB,GAAG,IAAA,cAAS,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;KACnD,CAAC;AACJ,CAAC;AAIQ,wBAAM;AAFf,yDAAuC","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 * as React from \"react\";\nimport { render as rtlRender } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport type { ReportsConfigContextProps } from \"../widget/components/ReportsConfigContext\";\nimport { ReportsConfigContext } from \"../widget/components/ReportsConfigContext\";\n\nexport const mockAccessToken = async () => \"Bearer eyJhbGci\";\n\ninterface WrapperProps {\n children?: React.ReactNode;\n}\nexport const mockITwinId: string = \"mockiTwinId\";\n\nfunction render(ui: React.ReactElement, contextProps?: Partial<ReportsConfigContextProps>, { ...options } = {}) {\n const Wrapper = ({ children }: WrapperProps) => (\n <ReportsConfigContext\n getAccessToken={mockAccessToken}\n iTwinId={contextProps?.iTwinId ?? mockITwinId}\n {...contextProps}\n >\n {children}\n </ReportsConfigContext>\n );\n\n return {\n user: userEvent.setup(),\n ...rtlRender(ui, { wrapper: Wrapper, ...options }),\n };\n}\n\nexport * from \"@testing-library/react\";\n// override React Testing Library's render with our own\nexport { render };\n"]}