@itwin/reports-config-widget-react 0.0.1

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 (294) hide show
  1. package/.rush/temp/package-deps_rebuild.json +48 -0
  2. package/.rush/temp/shrinkwrap-deps.json +868 -0
  3. package/CHANGELOG.json +17 -0
  4. package/CHANGELOG.md +11 -0
  5. package/LICENSE.md +9 -0
  6. package/README.md +38 -0
  7. package/__mocks__/fileMock.js +5 -0
  8. package/coverage/clover.xml +612 -0
  9. package/coverage/coverage-final.json +19 -0
  10. package/coverage/lcov-report/base.css +224 -0
  11. package/coverage/lcov-report/block-navigation.js +87 -0
  12. package/coverage/lcov-report/favicon.png +0 -0
  13. package/coverage/lcov-report/index.html +191 -0
  14. package/coverage/lcov-report/prettify.css +1 -0
  15. package/coverage/lcov-report/prettify.js +2 -0
  16. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  17. package/coverage/lcov-report/sorter.js +196 -0
  18. package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +193 -0
  19. package/coverage/lcov-report/src/index.html +116 -0
  20. package/coverage/lcov-report/src/test/index.html +116 -0
  21. package/coverage/lcov-report/src/test/test-utils.tsx.html +316 -0
  22. package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +286 -0
  23. package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +253 -0
  24. package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +610 -0
  25. package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +385 -0
  26. package/coverage/lcov-report/src/widget/components/Extraction.tsx.html +1030 -0
  27. package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +256 -0
  28. package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +262 -0
  29. package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +523 -0
  30. package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +1135 -0
  31. package/coverage/lcov-report/src/widget/components/Reports.tsx.html +829 -0
  32. package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +193 -0
  33. package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +271 -0
  34. package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +391 -0
  35. package/coverage/lcov-report/src/widget/components/index.html +296 -0
  36. package/coverage/lcov-report/src/widget/components/utils.tsx.html +562 -0
  37. package/coverage/lcov-report/src/widget/context/ReportsApiConfigContext.tsx.html +166 -0
  38. package/coverage/lcov-report/src/widget/context/index.html +116 -0
  39. package/coverage/lcov-report/src/widget/hooks/index.html +116 -0
  40. package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +295 -0
  41. package/coverage/lcov-report/src/widget/index.html +116 -0
  42. package/coverage/lcov.info +1260 -0
  43. package/jest.config.js +19 -0
  44. package/lib/cjs/ReportsConfigWidget.d.ts +10 -0
  45. package/lib/cjs/ReportsConfigWidget.d.ts.map +1 -0
  46. package/lib/cjs/ReportsConfigWidget.js +24 -0
  47. package/lib/cjs/ReportsConfigWidget.js.map +1 -0
  48. package/lib/cjs/reports-config-widget-react.d.ts +4 -0
  49. package/lib/cjs/reports-config-widget-react.d.ts.map +1 -0
  50. package/lib/cjs/reports-config-widget-react.js +20 -0
  51. package/lib/cjs/reports-config-widget-react.js.map +1 -0
  52. package/lib/cjs/test/ReportAction.test.d.ts +2 -0
  53. package/lib/cjs/test/ReportAction.test.d.ts.map +1 -0
  54. package/lib/cjs/test/ReportAction.test.js +194 -0
  55. package/lib/cjs/test/ReportAction.test.js.map +1 -0
  56. package/lib/cjs/test/ReportMappings.test.d.ts +2 -0
  57. package/lib/cjs/test/ReportMappings.test.d.ts.map +1 -0
  58. package/lib/cjs/test/ReportMappings.test.js +530 -0
  59. package/lib/cjs/test/ReportMappings.test.js.map +1 -0
  60. package/lib/cjs/test/Reports.test.d.ts +2 -0
  61. package/lib/cjs/test/Reports.test.d.ts.map +1 -0
  62. package/lib/cjs/test/Reports.test.js +232 -0
  63. package/lib/cjs/test/Reports.test.js.map +1 -0
  64. package/lib/cjs/test/WidgetHeader.test.d.ts +2 -0
  65. package/lib/cjs/test/WidgetHeader.test.d.ts.map +1 -0
  66. package/lib/cjs/test/WidgetHeader.test.js +30 -0
  67. package/lib/cjs/test/WidgetHeader.test.js.map +1 -0
  68. package/lib/cjs/test/test-utils.d.ts +69 -0
  69. package/lib/cjs/test/test-utils.d.ts.map +1 -0
  70. package/lib/cjs/test/test-utils.js +77 -0
  71. package/lib/cjs/test/test-utils.js.map +1 -0
  72. package/lib/cjs/tsconfig.tsbuildinfo +1 -0
  73. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts +12 -0
  74. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts.map +1 -0
  75. package/lib/cjs/widget/ReportsConfigUiProvider.js +55 -0
  76. package/lib/cjs/widget/ReportsConfigUiProvider.js.map +1 -0
  77. package/lib/cjs/widget/components/ActionPanel.d.ts +13 -0
  78. package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -0
  79. package/lib/cjs/widget/components/ActionPanel.js +39 -0
  80. package/lib/cjs/widget/components/ActionPanel.js.map +1 -0
  81. package/lib/cjs/widget/components/ActionPanel.scss +12 -0
  82. package/lib/cjs/widget/components/AddMappingsModal.d.ts +15 -0
  83. package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -0
  84. package/lib/cjs/widget/components/AddMappingsModal.js +118 -0
  85. package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -0
  86. package/lib/cjs/widget/components/AddMappingsModal.scss +18 -0
  87. package/lib/cjs/widget/components/DeleteModal.d.ts +12 -0
  88. package/lib/cjs/widget/components/DeleteModal.d.ts.map +1 -0
  89. package/lib/cjs/widget/components/DeleteModal.js +65 -0
  90. package/lib/cjs/widget/components/DeleteModal.js.map +1 -0
  91. package/lib/cjs/widget/components/DeleteModal.scss +18 -0
  92. package/lib/cjs/widget/components/Extraction.d.ts +28 -0
  93. package/lib/cjs/widget/components/Extraction.d.ts.map +1 -0
  94. package/lib/cjs/widget/components/Extraction.js +193 -0
  95. package/lib/cjs/widget/components/Extraction.js.map +1 -0
  96. package/lib/cjs/widget/components/Extraction.scss +39 -0
  97. package/lib/cjs/widget/components/HorizontalTile.d.ts +13 -0
  98. package/lib/cjs/widget/components/HorizontalTile.d.ts.map +1 -0
  99. package/lib/cjs/widget/components/HorizontalTile.js +18 -0
  100. package/lib/cjs/widget/components/HorizontalTile.js.map +1 -0
  101. package/lib/cjs/widget/components/HorizontalTile.scss +32 -0
  102. package/lib/cjs/widget/components/LocalizedTablePaginator.d.ts +4 -0
  103. package/lib/cjs/widget/components/LocalizedTablePaginator.d.ts.map +1 -0
  104. package/lib/cjs/widget/components/LocalizedTablePaginator.js +41 -0
  105. package/lib/cjs/widget/components/LocalizedTablePaginator.js.map +1 -0
  106. package/lib/cjs/widget/components/ReportAction.d.ts +11 -0
  107. package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -0
  108. package/lib/cjs/widget/components/ReportAction.js +101 -0
  109. package/lib/cjs/widget/components/ReportAction.js.map +1 -0
  110. package/lib/cjs/widget/components/ReportAction.scss +16 -0
  111. package/lib/cjs/widget/components/ReportMappings.d.ts +17 -0
  112. package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -0
  113. package/lib/cjs/widget/components/ReportMappings.js +174 -0
  114. package/lib/cjs/widget/components/ReportMappings.js.map +1 -0
  115. package/lib/cjs/widget/components/ReportMappings.scss +46 -0
  116. package/lib/cjs/widget/components/Reports.d.ts +7 -0
  117. package/lib/cjs/widget/components/Reports.d.ts.map +1 -0
  118. package/lib/cjs/widget/components/Reports.js +143 -0
  119. package/lib/cjs/widget/components/Reports.js.map +1 -0
  120. package/lib/cjs/widget/components/Reports.scss +36 -0
  121. package/lib/cjs/widget/components/ReportsContainer.d.ts +10 -0
  122. package/lib/cjs/widget/components/ReportsContainer.d.ts.map +1 -0
  123. package/lib/cjs/widget/components/ReportsContainer.js +34 -0
  124. package/lib/cjs/widget/components/ReportsContainer.js.map +1 -0
  125. package/lib/cjs/widget/components/ReportsContainer.scss +15 -0
  126. package/lib/cjs/widget/components/SearchBar.d.ts +10 -0
  127. package/lib/cjs/widget/components/SearchBar.d.ts.map +1 -0
  128. package/lib/cjs/widget/components/SearchBar.js +50 -0
  129. package/lib/cjs/widget/components/SearchBar.js.map +1 -0
  130. package/lib/cjs/widget/components/SearchBar.scss +27 -0
  131. package/lib/cjs/widget/components/SelectIModel.d.ts +9 -0
  132. package/lib/cjs/widget/components/SelectIModel.d.ts.map +1 -0
  133. package/lib/cjs/widget/components/SelectIModel.js +82 -0
  134. package/lib/cjs/widget/components/SelectIModel.js.map +1 -0
  135. package/lib/cjs/widget/components/SelectIModel.scss +15 -0
  136. package/lib/cjs/widget/components/utils.d.ts +23 -0
  137. package/lib/cjs/widget/components/utils.d.ts.map +1 -0
  138. package/lib/cjs/widget/components/utils.js +87 -0
  139. package/lib/cjs/widget/components/utils.js.map +1 -0
  140. package/lib/cjs/widget/components/utils.scss +39 -0
  141. package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts +9 -0
  142. package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts.map +1 -0
  143. package/lib/cjs/widget/context/ReportsApiConfigContext.js +37 -0
  144. package/lib/cjs/widget/context/ReportsApiConfigContext.js.map +1 -0
  145. package/lib/cjs/widget/hooks/useValidator.d.ts +8 -0
  146. package/lib/cjs/widget/hooks/useValidator.d.ts.map +1 -0
  147. package/lib/cjs/widget/hooks/useValidator.js +56 -0
  148. package/lib/cjs/widget/hooks/useValidator.js.map +1 -0
  149. package/lib/esm/ReportsConfigWidget.d.ts +10 -0
  150. package/lib/esm/ReportsConfigWidget.d.ts.map +1 -0
  151. package/lib/esm/ReportsConfigWidget.js +20 -0
  152. package/lib/esm/ReportsConfigWidget.js.map +1 -0
  153. package/lib/esm/reports-config-widget-react.d.ts +4 -0
  154. package/lib/esm/reports-config-widget-react.d.ts.map +1 -0
  155. package/lib/esm/reports-config-widget-react.js +8 -0
  156. package/lib/esm/reports-config-widget-react.js.map +1 -0
  157. package/lib/esm/test/ReportAction.test.d.ts +2 -0
  158. package/lib/esm/test/ReportAction.test.d.ts.map +1 -0
  159. package/lib/esm/test/ReportAction.test.js +170 -0
  160. package/lib/esm/test/ReportAction.test.js.map +1 -0
  161. package/lib/esm/test/ReportMappings.test.d.ts +2 -0
  162. package/lib/esm/test/ReportMappings.test.d.ts.map +1 -0
  163. package/lib/esm/test/ReportMappings.test.js +506 -0
  164. package/lib/esm/test/ReportMappings.test.js.map +1 -0
  165. package/lib/esm/test/Reports.test.d.ts +2 -0
  166. package/lib/esm/test/Reports.test.d.ts.map +1 -0
  167. package/lib/esm/test/Reports.test.js +208 -0
  168. package/lib/esm/test/Reports.test.js.map +1 -0
  169. package/lib/esm/test/WidgetHeader.test.d.ts +2 -0
  170. package/lib/esm/test/WidgetHeader.test.d.ts.map +1 -0
  171. package/lib/esm/test/WidgetHeader.test.js +25 -0
  172. package/lib/esm/test/WidgetHeader.test.js.map +1 -0
  173. package/lib/esm/test/test-utils.d.ts +69 -0
  174. package/lib/esm/test/test-utils.d.ts.map +1 -0
  175. package/lib/esm/test/test-utils.js +48 -0
  176. package/lib/esm/test/test-utils.js.map +1 -0
  177. package/lib/esm/tsconfig.tsbuildinfo +1 -0
  178. package/lib/esm/widget/ReportsConfigUiProvider.d.ts +12 -0
  179. package/lib/esm/widget/ReportsConfigUiProvider.d.ts.map +1 -0
  180. package/lib/esm/widget/ReportsConfigUiProvider.js +29 -0
  181. package/lib/esm/widget/ReportsConfigUiProvider.js.map +1 -0
  182. package/lib/esm/widget/components/ActionPanel.d.ts +13 -0
  183. package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -0
  184. package/lib/esm/widget/components/ActionPanel.js +18 -0
  185. package/lib/esm/widget/components/ActionPanel.js.map +1 -0
  186. package/lib/esm/widget/components/ActionPanel.scss +12 -0
  187. package/lib/esm/widget/components/AddMappingsModal.d.ts +15 -0
  188. package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -0
  189. package/lib/esm/widget/components/AddMappingsModal.js +94 -0
  190. package/lib/esm/widget/components/AddMappingsModal.js.map +1 -0
  191. package/lib/esm/widget/components/AddMappingsModal.scss +18 -0
  192. package/lib/esm/widget/components/DeleteModal.d.ts +12 -0
  193. package/lib/esm/widget/components/DeleteModal.d.ts.map +1 -0
  194. package/lib/esm/widget/components/DeleteModal.js +42 -0
  195. package/lib/esm/widget/components/DeleteModal.js.map +1 -0
  196. package/lib/esm/widget/components/DeleteModal.scss +18 -0
  197. package/lib/esm/widget/components/Extraction.d.ts +28 -0
  198. package/lib/esm/widget/components/Extraction.d.ts.map +1 -0
  199. package/lib/esm/widget/components/Extraction.js +169 -0
  200. package/lib/esm/widget/components/Extraction.js.map +1 -0
  201. package/lib/esm/widget/components/Extraction.scss +39 -0
  202. package/lib/esm/widget/components/HorizontalTile.d.ts +13 -0
  203. package/lib/esm/widget/components/HorizontalTile.d.ts.map +1 -0
  204. package/lib/esm/widget/components/HorizontalTile.js +11 -0
  205. package/lib/esm/widget/components/HorizontalTile.js.map +1 -0
  206. package/lib/esm/widget/components/HorizontalTile.scss +32 -0
  207. package/lib/esm/widget/components/LocalizedTablePaginator.d.ts +4 -0
  208. package/lib/esm/widget/components/LocalizedTablePaginator.d.ts.map +1 -0
  209. package/lib/esm/widget/components/LocalizedTablePaginator.js +18 -0
  210. package/lib/esm/widget/components/LocalizedTablePaginator.js.map +1 -0
  211. package/lib/esm/widget/components/ReportAction.d.ts +11 -0
  212. package/lib/esm/widget/components/ReportAction.d.ts.map +1 -0
  213. package/lib/esm/widget/components/ReportAction.js +77 -0
  214. package/lib/esm/widget/components/ReportAction.js.map +1 -0
  215. package/lib/esm/widget/components/ReportAction.scss +16 -0
  216. package/lib/esm/widget/components/ReportMappings.d.ts +17 -0
  217. package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -0
  218. package/lib/esm/widget/components/ReportMappings.js +148 -0
  219. package/lib/esm/widget/components/ReportMappings.js.map +1 -0
  220. package/lib/esm/widget/components/ReportMappings.scss +46 -0
  221. package/lib/esm/widget/components/Reports.d.ts +7 -0
  222. package/lib/esm/widget/components/Reports.d.ts.map +1 -0
  223. package/lib/esm/widget/components/Reports.js +117 -0
  224. package/lib/esm/widget/components/Reports.js.map +1 -0
  225. package/lib/esm/widget/components/Reports.scss +36 -0
  226. package/lib/esm/widget/components/ReportsContainer.d.ts +10 -0
  227. package/lib/esm/widget/components/ReportsContainer.d.ts.map +1 -0
  228. package/lib/esm/widget/components/ReportsContainer.js +13 -0
  229. package/lib/esm/widget/components/ReportsContainer.js.map +1 -0
  230. package/lib/esm/widget/components/ReportsContainer.scss +15 -0
  231. package/lib/esm/widget/components/SearchBar.d.ts +10 -0
  232. package/lib/esm/widget/components/SearchBar.d.ts.map +1 -0
  233. package/lib/esm/widget/components/SearchBar.js +27 -0
  234. package/lib/esm/widget/components/SearchBar.js.map +1 -0
  235. package/lib/esm/widget/components/SearchBar.scss +27 -0
  236. package/lib/esm/widget/components/SelectIModel.d.ts +9 -0
  237. package/lib/esm/widget/components/SelectIModel.d.ts.map +1 -0
  238. package/lib/esm/widget/components/SelectIModel.js +59 -0
  239. package/lib/esm/widget/components/SelectIModel.js.map +1 -0
  240. package/lib/esm/widget/components/SelectIModel.scss +15 -0
  241. package/lib/esm/widget/components/utils.d.ts +23 -0
  242. package/lib/esm/widget/components/utils.d.ts.map +1 -0
  243. package/lib/esm/widget/components/utils.js +73 -0
  244. package/lib/esm/widget/components/utils.js.map +1 -0
  245. package/lib/esm/widget/components/utils.scss +39 -0
  246. package/lib/esm/widget/context/ReportsApiConfigContext.d.ts +9 -0
  247. package/lib/esm/widget/context/ReportsApiConfigContext.d.ts.map +1 -0
  248. package/lib/esm/widget/context/ReportsApiConfigContext.js +14 -0
  249. package/lib/esm/widget/context/ReportsApiConfigContext.js.map +1 -0
  250. package/lib/esm/widget/hooks/useValidator.d.ts +8 -0
  251. package/lib/esm/widget/hooks/useValidator.d.ts.map +1 -0
  252. package/lib/esm/widget/hooks/useValidator.js +50 -0
  253. package/lib/esm/widget/hooks/useValidator.js.map +1 -0
  254. package/lib/public/locales/en/ReportsConfigWidget.json +76 -0
  255. package/package.json +124 -0
  256. package/public/locales/en/ReportsConfigWidget.json +76 -0
  257. package/reports-config-widget-react.build.error.log +10 -0
  258. package/reports-config-widget-react.build.log +45 -0
  259. package/src/ReportsConfigWidget.ts +36 -0
  260. package/src/reports-config-widget-react.ts +7 -0
  261. package/src/test/ReportAction.test.tsx +258 -0
  262. package/src/test/ReportMappings.test.tsx +882 -0
  263. package/src/test/Reports.test.tsx +365 -0
  264. package/src/test/WidgetHeader.test.tsx +29 -0
  265. package/src/test/test-utils.tsx +77 -0
  266. package/src/widget/ReportsConfigUiProvider.tsx +67 -0
  267. package/src/widget/components/ActionPanel.scss +12 -0
  268. package/src/widget/components/ActionPanel.tsx +56 -0
  269. package/src/widget/components/AddMappingsModal.scss +18 -0
  270. package/src/widget/components/AddMappingsModal.tsx +175 -0
  271. package/src/widget/components/DeleteModal.scss +18 -0
  272. package/src/widget/components/DeleteModal.tsx +100 -0
  273. package/src/widget/components/Extraction.scss +39 -0
  274. package/src/widget/components/Extraction.tsx +315 -0
  275. package/src/widget/components/HorizontalTile.scss +32 -0
  276. package/src/widget/components/HorizontalTile.tsx +57 -0
  277. package/src/widget/components/LocalizedTablePaginator.tsx +59 -0
  278. package/src/widget/components/ReportAction.scss +16 -0
  279. package/src/widget/components/ReportAction.tsx +146 -0
  280. package/src/widget/components/ReportMappings.scss +46 -0
  281. package/src/widget/components/ReportMappings.tsx +350 -0
  282. package/src/widget/components/Reports.scss +36 -0
  283. package/src/widget/components/Reports.tsx +248 -0
  284. package/src/widget/components/ReportsContainer.scss +15 -0
  285. package/src/widget/components/ReportsContainer.tsx +36 -0
  286. package/src/widget/components/SearchBar.scss +27 -0
  287. package/src/widget/components/SearchBar.tsx +62 -0
  288. package/src/widget/components/SelectIModel.scss +15 -0
  289. package/src/widget/components/SelectIModel.tsx +102 -0
  290. package/src/widget/components/utils.scss +39 -0
  291. package/src/widget/components/utils.tsx +159 -0
  292. package/src/widget/context/ReportsApiConfigContext.tsx +27 -0
  293. package/src/widget/hooks/useValidator.ts +70 -0
  294. package/tsconfig.json +11 -0
@@ -0,0 +1,506 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import React from "react";
6
+ import faker from "@faker-js/faker";
7
+ import "@testing-library/jest-dom";
8
+ import { NoRenderApp } from "@itwin/core-frontend";
9
+ import { ReportsConfigWidget } from "../ReportsConfigWidget";
10
+ import { setupServer } from "msw/node";
11
+ import { render, screen, TestUtils, waitForElementToBeRemoved, within, } from "./test-utils";
12
+ import userEvent from "@testing-library/user-event";
13
+ import * as moq from "typemoq";
14
+ import { rest } from "msw";
15
+ import { ReportMappings } from "../widget/components/ReportMappings";
16
+ import { Constants, IModelState } from "@itwin/imodels-client-management";
17
+ import { REPORTS_CONFIG_BASE_URL } from "../widget/ReportsConfigUiProvider";
18
+ import { REFRESH_DELAY } from "../widget/components/Extraction";
19
+ import { Presentation, SelectionChangeEvent, } from "@itwin/presentation-frontend";
20
+ // For the extraction test
21
+ jest.setTimeout(20000);
22
+ const mockITwinId = faker.datatype.uuid();
23
+ // Lets work with two iModels for now.
24
+ const mockIModelId1 = faker.datatype.uuid();
25
+ const mockIModelId2 = faker.datatype.uuid();
26
+ const mockReportId = faker.datatype.uuid();
27
+ const mockIModelsResponse = [
28
+ {
29
+ iModel: {
30
+ id: mockIModelId1,
31
+ displayName: faker.random.alpha(10),
32
+ name: faker.random.alpha(10),
33
+ description: faker.random.words(10),
34
+ createdDateTime: "2021-10-04T22:13:50.397Z",
35
+ state: IModelState.Initialized,
36
+ projectId: mockITwinId,
37
+ extent: null,
38
+ _links: {
39
+ creator: {
40
+ href: "",
41
+ },
42
+ namedVersions: {
43
+ href: "",
44
+ },
45
+ changesets: {
46
+ href: "",
47
+ },
48
+ },
49
+ },
50
+ },
51
+ {
52
+ iModel: {
53
+ id: mockIModelId2,
54
+ displayName: faker.random.alpha(10),
55
+ name: faker.random.alpha(10),
56
+ description: faker.random.words(10),
57
+ createdDateTime: "2021-10-04T22:13:50.397Z",
58
+ state: IModelState.Initialized,
59
+ projectId: mockITwinId,
60
+ extent: null,
61
+ _links: {
62
+ creator: {
63
+ href: "",
64
+ },
65
+ namedVersions: {
66
+ href: "",
67
+ },
68
+ changesets: {
69
+ href: "",
70
+ },
71
+ },
72
+ },
73
+ },
74
+ ];
75
+ const mockProjectIModels = {
76
+ iModels: mockIModelsResponse.map((iModel) => ({
77
+ id: iModel.iModel.id,
78
+ displayName: iModel.iModel.displayName,
79
+ })),
80
+ _links: {
81
+ self: {
82
+ href: "",
83
+ },
84
+ prev: null,
85
+ next: null,
86
+ },
87
+ };
88
+ const mockReport = {
89
+ id: mockReportId,
90
+ displayName: faker.random.alpha(10),
91
+ description: faker.random.words(10),
92
+ deleted: false,
93
+ _links: {
94
+ project: {
95
+ href: "",
96
+ },
97
+ },
98
+ };
99
+ const mockReportMappingsFactory = () => {
100
+ return {
101
+ mappings: [
102
+ {
103
+ reportId: mockReportId,
104
+ mappingId: faker.datatype.uuid(),
105
+ imodelId: mockIModelId1,
106
+ _links: {
107
+ report: {
108
+ href: "",
109
+ },
110
+ mapping: {
111
+ href: "",
112
+ },
113
+ imodel: {
114
+ href: "",
115
+ },
116
+ },
117
+ },
118
+ {
119
+ reportId: mockReportId,
120
+ mappingId: faker.datatype.uuid(),
121
+ imodelId: mockIModelId2,
122
+ _links: {
123
+ report: {
124
+ href: "",
125
+ },
126
+ mapping: {
127
+ href: "",
128
+ },
129
+ imodel: {
130
+ href: "",
131
+ },
132
+ },
133
+ },
134
+ ],
135
+ _links: {
136
+ next: undefined,
137
+ self: {
138
+ href: "",
139
+ },
140
+ },
141
+ };
142
+ };
143
+ const mockMappingsFactory = (mockReportMappings) => {
144
+ const mockMappings = mockReportMappings.mappings.map((mapping) => ({
145
+ mapping: {
146
+ id: mapping.mappingId,
147
+ mappingName: faker.random.alpha(10),
148
+ description: faker.random.words(10),
149
+ extractionEnabled: false,
150
+ createdOn: "",
151
+ createdBy: "",
152
+ modifiedOn: "",
153
+ modifiedBy: "",
154
+ _links: {
155
+ imodel: {
156
+ // Tie the mapping to to the iModel Id
157
+ href: mapping.imodelId,
158
+ },
159
+ },
160
+ },
161
+ }));
162
+ const iModelHandlers = mockMappings.map((mapping) => {
163
+ var _a, _b, _c, _d, _e;
164
+ return rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/datasources/imodels/${(_d = (_c = (_b = (_a = mapping.mapping) === null || _a === void 0 ? void 0 : _a._links) === null || _b === void 0 ? void 0 : _b.imodel) === null || _c === void 0 ? void 0 : _c.href) !== null && _d !== void 0 ? _d : ""}/mappings/${(_e = mapping.mapping) === null || _e === void 0 ? void 0 : _e.id}`, async (_req, res, ctx) => {
165
+ return res(ctx.delay(), ctx.status(200), ctx.json(mapping));
166
+ });
167
+ });
168
+ return [mockMappings, iModelHandlers];
169
+ };
170
+ const connectionMock = moq.Mock.ofType();
171
+ const selectionManagerMock = moq.Mock.ofType();
172
+ const selectionScopesManagerMock = moq.Mock.ofType();
173
+ jest.mock("@itwin/appui-react", () => ({
174
+ ...jest.requireActual("@itwin/appui-react"),
175
+ useActiveIModelConnection: () => connectionMock.object,
176
+ }));
177
+ const server = setupServer();
178
+ beforeAll(async () => {
179
+ // This is required by the i18n module within iTwin.js
180
+ global.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; // eslint-disable-line @typescript-eslint/no-var-requires
181
+ await NoRenderApp.startup();
182
+ await Presentation.initialize();
183
+ const selectionSet = moq.Mock.ofType();
184
+ const onChanged = moq.Mock.ofType();
185
+ selectionSet.setup((x) => x.elements).returns(() => new Set([]));
186
+ selectionSet.setup((x) => x.onChanged).returns(() => onChanged.object);
187
+ connectionMock
188
+ .setup((x) => x.selectionSet)
189
+ .returns(() => selectionSet.object);
190
+ connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId1);
191
+ connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);
192
+ selectionManagerMock
193
+ .setup((x) => x.selectionChange)
194
+ .returns(() => new SelectionChangeEvent());
195
+ selectionScopesManagerMock
196
+ .setup(async (x) => x.getSelectionScopes(connectionMock.object))
197
+ .returns(async () => []);
198
+ selectionManagerMock
199
+ .setup((x) => x.scopes)
200
+ .returns(() => selectionScopesManagerMock.object);
201
+ Presentation.setSelectionManager(selectionManagerMock.object);
202
+ await TestUtils.initializeUiFramework(connectionMock.object);
203
+ await ReportsConfigWidget.initialize();
204
+ server.listen();
205
+ });
206
+ afterAll(() => {
207
+ TestUtils.terminateUiFramework();
208
+ server.close();
209
+ });
210
+ afterEach(() => {
211
+ server.resetHandlers();
212
+ });
213
+ describe("Report Mappings View", () => {
214
+ it("shows all report mappings", async () => {
215
+ var _a, _b, _c, _d, _e;
216
+ const mockReportMappings = mockReportMappingsFactory();
217
+ const [mockMappings, iModelHandlers] = mockMappingsFactory(mockReportMappings);
218
+ server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`, async (_req, res, ctx) => {
219
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockReportMappings));
220
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId1}`, async (_req, res, ctx) => {
221
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[0]));
222
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId2}`, async (_req, res, ctx) => {
223
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[1]));
224
+ }), ...iModelHandlers);
225
+ render(React.createElement(ReportMappings, { report: mockReport, goBack: jest.fn() }));
226
+ await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
227
+ const horizontalTiles = screen.getAllByTestId("horizontal-tile");
228
+ expect(horizontalTiles).toHaveLength(mockMappings.length);
229
+ for (const [index, horizontalTile] of horizontalTiles.entries()) {
230
+ const reportMappingTile = within(horizontalTile);
231
+ const mockiModel = mockIModelsResponse.find((iModel) => { var _a, _b, _c; return iModel.iModel.id === ((_c = (_b = (_a = mockMappings[index].mapping) === null || _a === void 0 ? void 0 : _a._links) === null || _b === void 0 ? void 0 : _b.imodel) === null || _c === void 0 ? void 0 : _c.href); });
232
+ expect(reportMappingTile.getByText((_b = (_a = mockMappings[index].mapping) === null || _a === void 0 ? void 0 : _a.mappingName) !== null && _b !== void 0 ? _b : "")).toBeInTheDocument();
233
+ expect(reportMappingTile.getByTitle((_d = (_c = mockMappings[index].mapping) === null || _c === void 0 ? void 0 : _c.description) !== null && _d !== void 0 ? _d : "")).toBeInTheDocument();
234
+ expect(reportMappingTile.getByText((_e = mockiModel === null || mockiModel === void 0 ? void 0 : mockiModel.iModel.displayName) !== null && _e !== void 0 ? _e : "")).toBeInTheDocument();
235
+ }
236
+ });
237
+ it("search for a report mapping", async () => {
238
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
239
+ const mockReportMappings = mockReportMappingsFactory();
240
+ const [mockMappings, iModelHandlers] = mockMappingsFactory(mockReportMappings);
241
+ server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`, async (_req, res, ctx) => {
242
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockReportMappings));
243
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId1}`, async (_req, res, ctx) => {
244
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[0]));
245
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId2}`, async (_req, res, ctx) => {
246
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[1]));
247
+ }), ...iModelHandlers);
248
+ const { user } = render(React.createElement(ReportMappings, { report: mockReport, goBack: jest.fn() }));
249
+ await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
250
+ const searchButton = within(screen.getByTestId(/search-bar/i)).getByRole("button");
251
+ await user.click(searchButton);
252
+ const searchInput = screen.getByRole("textbox", {
253
+ name: /search\-textbox/i,
254
+ });
255
+ // Be an exact match on display name.
256
+ await user.type(searchInput, (_b = (_a = mockMappings[0].mapping) === null || _a === void 0 ? void 0 : _a.mappingName) !== null && _b !== void 0 ? _b : "");
257
+ expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
258
+ expect(screen.getByText((_d = (_c = mockMappings[0].mapping) === null || _c === void 0 ? void 0 : _c.mappingName) !== null && _d !== void 0 ? _d : "")).toBeInTheDocument();
259
+ // Be an exact match on description.
260
+ await user.clear(searchInput);
261
+ await user.type(searchInput, (_f = (_e = mockMappings[0].mapping) === null || _e === void 0 ? void 0 : _e.description) !== null && _f !== void 0 ? _f : "");
262
+ expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
263
+ expect(screen.getByTitle((_h = (_g = mockMappings[0].mapping) === null || _g === void 0 ? void 0 : _g.description) !== null && _h !== void 0 ? _h : "")).toBeInTheDocument();
264
+ // Be an exact match on iModel Name.
265
+ const iModel = mockIModelsResponse.find((mockIModel) => { var _a, _b, _c; return mockIModel.iModel.id === ((_c = (_b = (_a = mockMappings[0].mapping) === null || _a === void 0 ? void 0 : _a._links) === null || _b === void 0 ? void 0 : _b.imodel) === null || _c === void 0 ? void 0 : _c.href); });
266
+ await user.clear(searchInput);
267
+ await user.type(searchInput, (_j = iModel === null || iModel === void 0 ? void 0 : iModel.iModel.displayName) !== null && _j !== void 0 ? _j : "");
268
+ expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
269
+ expect(screen.getByText((_k = iModel === null || iModel === void 0 ? void 0 : iModel.iModel.displayName) !== null && _k !== void 0 ? _k : "")).toBeInTheDocument();
270
+ });
271
+ it("remove a report mapping", async () => {
272
+ var _a;
273
+ const mockReportMappings = mockReportMappingsFactory();
274
+ const [_, iModelHandlers] = mockMappingsFactory(mockReportMappings);
275
+ const mockReportMappingsOriginalSize = mockReportMappings.mappings.length;
276
+ server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`, async (_req, res, ctx) => {
277
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockReportMappings));
278
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId1}`, async (_req, res, ctx) => {
279
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[0]));
280
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId2}`, async (_req, res, ctx) => {
281
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[1]));
282
+ }), ...iModelHandlers, rest.delete(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings/${(_a = mockReportMappings.mappings[0].mappingId) !== null && _a !== void 0 ? _a : ""}`, async (_req, res, ctx) => {
283
+ mockReportMappings.mappings = mockReportMappings.mappings.filter((mapping) => {
284
+ var _a;
285
+ return (_a = mapping.mappingId !== mockReportMappings.mappings[0].mappingId) !== null && _a !== void 0 ? _a : "";
286
+ });
287
+ return res(ctx.delay(100), ctx.status(204));
288
+ }));
289
+ const { user } = render(React.createElement(ReportMappings, { report: mockReport, goBack: jest.fn() }));
290
+ await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
291
+ const firstMenuDropdown = within(screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
292
+ await user.click(firstMenuDropdown);
293
+ const removeButton = screen.getByRole("menuitem", { name: /remove/i });
294
+ await user.click(removeButton);
295
+ // Delete modal dialog should appear
296
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
297
+ const deleteButton = screen.getByRole("button", {
298
+ name: /delete/i,
299
+ });
300
+ await user.click(deleteButton);
301
+ await waitForElementToBeRemoved(() => screen.getByTestId(/rcw-loading-delete/i));
302
+ await waitForElementToBeRemoved(() => screen.getByRole("dialog"));
303
+ // Should be one less mapping
304
+ expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(mockReportMappingsOriginalSize - 1);
305
+ });
306
+ it("add mapping", async () => {
307
+ var _a, _b, _c, _d;
308
+ const mockReportMappings = mockReportMappingsFactory();
309
+ const [mockMappings, iModelHandlers] = mockMappingsFactory(mockReportMappings);
310
+ // Adding an extra unmapped mapping.
311
+ const extraMappingId = faker.datatype.uuid();
312
+ const extraMappingName = faker.random.alpha(10);
313
+ mockMappings.push({
314
+ mapping: {
315
+ id: extraMappingId,
316
+ mappingName: extraMappingName,
317
+ description: faker.random.words(10),
318
+ extractionEnabled: false,
319
+ createdOn: "",
320
+ createdBy: "",
321
+ modifiedOn: "",
322
+ modifiedBy: "",
323
+ _links: {
324
+ imodel: {
325
+ href: "",
326
+ },
327
+ },
328
+ },
329
+ });
330
+ const mockMappingsResponse = {
331
+ // Type guarding
332
+ mappings: mockMappings
333
+ .map((mapping) => mapping.mapping)
334
+ .filter((mapping) => !!mapping),
335
+ _links: {
336
+ next: undefined,
337
+ self: {
338
+ href: "",
339
+ },
340
+ },
341
+ };
342
+ server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`, async (_req, res, ctx) => {
343
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockReportMappings));
344
+ }), rest.get(`${Constants.api.baseUrl}`, async (_req, res, ctx) => {
345
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockProjectIModels));
346
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId1}`, async (_req, res, ctx) => {
347
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[0]));
348
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId2}`, async (_req, res, ctx) => {
349
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[1]));
350
+ }), rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/datasources/imodels/${mockProjectIModels.iModels[0].id}/mappings`, async (_req, res, ctx) => {
351
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockMappingsResponse));
352
+ }), rest.post(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`, async (_req, res, ctx) => {
353
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockReportMappings));
354
+ }), ...iModelHandlers);
355
+ const { user } = render(React.createElement(ReportMappings, { report: mockReport, goBack: jest.fn() }));
356
+ await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
357
+ const addMappingButton = screen.getByRole("button", {
358
+ name: /addmapping/i,
359
+ });
360
+ await user.click(addMappingButton);
361
+ await waitForElementToBeRemoved(() => screen.getByTestId(/rcw-action-loading-spinner/i));
362
+ // Add modal dialog should appear
363
+ const modal = screen.getByRole("dialog");
364
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
365
+ const withinModal = within(modal);
366
+ expect(withinModal.getByText(/addmappings/i)).toBeInTheDocument();
367
+ const addButton = withinModal.getByRole("button", {
368
+ name: /add/i,
369
+ });
370
+ // Add button should be disabled
371
+ expect(addButton).toBeDisabled();
372
+ // Already mapped mappings are disabled
373
+ for (let i = 0; i < mockMappings.length - 1; i++) {
374
+ const row = screen.getByRole("row", {
375
+ name: new RegExp(`toggle row selected ${(_a = mockMappings[i].mapping) === null || _a === void 0 ? void 0 : _a.mappingName} ${(_b = mockMappings[i].mapping) === null || _b === void 0 ? void 0 : _b.description}`, "i"),
376
+ });
377
+ const checkbox = within(row).getByRole("checkbox", {
378
+ name: /toggle row selected/i,
379
+ });
380
+ expect(checkbox).toBeDisabled();
381
+ }
382
+ // Click on checkbox on new mapping
383
+ const unmappedRow = screen.getByRole("row", {
384
+ name: new RegExp(`toggle row selected ${(_c = mockMappings[mockMappings.length - 1].mapping) === null || _c === void 0 ? void 0 : _c.mappingName} ${(_d = mockMappings[mockMappings.length - 1].mapping) === null || _d === void 0 ? void 0 : _d.description}`, "i"),
385
+ });
386
+ const enabledCheckbox = within(unmappedRow).getByRole("checkbox", {
387
+ name: /toggle row selected/i,
388
+ });
389
+ await user.click(enabledCheckbox);
390
+ await user.click(addButton);
391
+ // Modal should go away
392
+ await waitForElementToBeRemoved(() => screen.getByTestId(/rcw-action-loading-spinner/i));
393
+ await waitForElementToBeRemoved(() => screen.getByRole("dialog"));
394
+ });
395
+ it("odata feed url", async () => {
396
+ const mockReportMappings = mockReportMappingsFactory();
397
+ const [_, iModelHandlers] = mockMappingsFactory(mockReportMappings);
398
+ server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`, async (_req, res, ctx) => {
399
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockReportMappings));
400
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId1}`, async (_req, res, ctx) => {
401
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[0]));
402
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId2}`, async (_req, res, ctx) => {
403
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[1]));
404
+ }), ...iModelHandlers);
405
+ const { user } = render(React.createElement(ReportMappings, { report: mockReport, goBack: jest.fn() }));
406
+ await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
407
+ const urlTextbox = screen.getByRole("textbox", {
408
+ name: /odatafeedurl/i,
409
+ });
410
+ expect(urlTextbox).toBeInTheDocument();
411
+ expect(screen.getByDisplayValue(`https://api.bentley.com/insights/reporting/odata/${mockReport.id}`)).toBeInTheDocument();
412
+ const copyButton = screen.getByRole("button", {
413
+ name: /copy/i,
414
+ });
415
+ await user.click(copyButton);
416
+ expect(screen.getByText(/copiedtoclipboard/i)).toBeInTheDocument();
417
+ });
418
+ it("full extraction", async () => {
419
+ const mockReportMappings = mockReportMappingsFactory();
420
+ const [_, iModelHandlers] = mockMappingsFactory(mockReportMappings);
421
+ const delay = REFRESH_DELAY;
422
+ // Faking timers currently makes all promise based queries from RTL become unpredictable.
423
+ // https://github.com/testing-library/dom-testing-library/issues/988
424
+ // Should come back to this later.
425
+ // Consequently, this test will be a bit slower.
426
+ // jest.useFakeTimers()
427
+ Element.prototype.scrollIntoView = jest.fn();
428
+ const mockIModel = mockIModelsResponse[0].iModel;
429
+ const mockRunId = faker.datatype.uuid();
430
+ const mockExtractionResponse = {
431
+ run: {
432
+ id: mockRunId,
433
+ _links: {
434
+ status: {
435
+ href: "",
436
+ },
437
+ },
438
+ },
439
+ };
440
+ let mockStatusResponse = {
441
+ status: {
442
+ state: "Queued",
443
+ reason: "",
444
+ },
445
+ };
446
+ server.use(rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`, async (_req, res, ctx) => {
447
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockReportMappings));
448
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId1}`, async (_req, res, ctx) => {
449
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[0]));
450
+ }), rest.get(`${Constants.api.baseUrl}/${mockIModelId2}`, async (_req, res, ctx) => {
451
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockIModelsResponse[1]));
452
+ }), ...iModelHandlers, rest.post(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/datasources/imodels/${mockIModel.id}/extraction/run`, async (_req, res, ctx) => {
453
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockExtractionResponse));
454
+ }), rest.get(`${REPORTS_CONFIG_BASE_URL}/insights/reporting/datasources/extraction/status/${mockRunId}`, async (_req, res, ctx) => {
455
+ return res(ctx.delay(), ctx.status(200), ctx.json(mockStatusResponse));
456
+ }));
457
+ render(React.createElement(ReportMappings, { report: mockReport, goBack: jest.fn() }));
458
+ // https://github.com/testing-library/user-event/issues/833
459
+ const user = userEvent.setup({ delay: null });
460
+ await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
461
+ const comboBox = screen.getByRole("combobox", {
462
+ name: /updatedataset/i,
463
+ });
464
+ await user.type(comboBox, mockIModel.displayName);
465
+ const option = screen.getByRole("option", {
466
+ name: mockIModel.displayName,
467
+ });
468
+ await user.click(option);
469
+ // Combobox should have correct status
470
+ const extractionComponent = screen.getByTestId("extraction-combo-box");
471
+ expect(within(extractionComponent).getByDisplayValue(mockIModel.displayName)).toBeInTheDocument();
472
+ // Should be two in the document. One in the status and the other in the list.
473
+ // TODO Assert that it is in the correct HorizontalTile
474
+ expect(screen.getAllByTitle(/starting/i)).toHaveLength(2);
475
+ const loadingStates = await screen.findAllByTitle(/loading/i);
476
+ expect(loadingStates).toHaveLength(2);
477
+ // act(() => {
478
+ // jest.advanceTimersByTime(2000)
479
+ // });
480
+ const queuedStates = await screen.findAllByTitle(/queued/i, undefined, {
481
+ timeout: delay,
482
+ });
483
+ expect(queuedStates).toHaveLength(2);
484
+ mockStatusResponse = {
485
+ status: {
486
+ state: "Running",
487
+ reason: "",
488
+ },
489
+ };
490
+ const runningStates = await screen.findAllByTitle(/running/i, undefined, {
491
+ timeout: delay,
492
+ });
493
+ expect(runningStates).toHaveLength(2);
494
+ mockStatusResponse = {
495
+ status: {
496
+ state: "Succeeded",
497
+ reason: "",
498
+ },
499
+ };
500
+ const succeededStates = await screen.findAllByTitle(/success/i, undefined, {
501
+ timeout: delay,
502
+ });
503
+ expect(succeededStates).toHaveLength(2);
504
+ });
505
+ });
506
+ //# sourceMappingURL=ReportMappings.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReportMappings.test.js","sourceRoot":"","sources":["../../../src/test/ReportMappings.test.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,2BAA2B,CAAC;AAMnC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;A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ACX;SACF,CAAC;QAEF,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,SAAS,EAAE;YACzE,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;QACH,MAAM,CAAC,eAAe,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC1C,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 faker from \"@faker-js/faker\";\nimport \"@testing-library/jest-dom\";\nimport type {\n IModelConnection,\n SelectionSet,\n SelectionSetEvent,\n} from \"@itwin/core-frontend\";\nimport { NoRenderApp } from \"@itwin/core-frontend\";\nimport { ReportsConfigWidget } from \"../ReportsConfigWidget\";\nimport { setupServer } from \"msw/node\";\nimport {\n render,\n screen,\n TestUtils,\n waitForElementToBeRemoved,\n within,\n} from \"./test-utils\";\nimport userEvent from \"@testing-library/user-event\";\nimport * as moq from \"typemoq\";\nimport type { RequestHandler } from \"msw\";\nimport { rest } from \"msw\";\nimport type {\n ExtractionStatus,\n Mapping,\n MappingCollection,\n MappingSingle,\n Report,\n ReportMappingCollection,\n} from \"@itwin/insights-client\";\nimport { ReportMappings } from \"../widget/components/ReportMappings\";\nimport { Constants, IModelState } from \"@itwin/imodels-client-management\";\nimport { REPORTS_CONFIG_BASE_URL } from \"../widget/ReportsConfigUiProvider\";\nimport { REFRESH_DELAY } from \"../widget/components/Extraction\";\nimport type {\n SelectionManager,\n SelectionScopesManager,\n} from \"@itwin/presentation-frontend\";\nimport {\n Presentation,\n SelectionChangeEvent,\n} from \"@itwin/presentation-frontend\";\nimport type { BeEvent } from \"@itwin/core-bentley\";\n\n// For the extraction test\njest.setTimeout(20000);\n\nconst mockITwinId = faker.datatype.uuid();\n// Lets work with two iModels for now.\nconst mockIModelId1 = faker.datatype.uuid();\nconst mockIModelId2 = faker.datatype.uuid();\n\nconst mockReportId = faker.datatype.uuid();\n\nconst mockIModelsResponse = [\n {\n iModel: {\n id: mockIModelId1,\n displayName: faker.random.alpha(10),\n name: faker.random.alpha(10),\n description: faker.random.words(10),\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: faker.random.alpha(10),\n name: faker.random.alpha(10),\n description: faker.random.words(10),\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: faker.random.alpha(10),\n description: faker.random.words(10),\n deleted: false,\n _links: {\n project: {\n href: \"\",\n },\n },\n};\n\nconst mockReportMappingsFactory = (): ReportMappingCollection => {\n return {\n mappings: [\n {\n reportId: mockReportId,\n mappingId: faker.datatype.uuid(),\n imodelId: mockIModelId1,\n _links: {\n report: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n imodel: {\n href: \"\",\n },\n },\n },\n {\n reportId: mockReportId,\n mappingId: faker.datatype.uuid(),\n imodelId: mockIModelId2,\n _links: {\n report: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n imodel: {\n href: \"\",\n },\n },\n },\n ],\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n };\n};\n\nconst mockMappingsFactory = (\n mockReportMappings: ReportMappingCollection\n): [MappingSingle[], RequestHandler[]] => {\n const mockMappings: MappingSingle[] = mockReportMappings.mappings!.map(\n (mapping) => ({\n mapping: {\n id: mapping.mappingId,\n mappingName: faker.random.alpha(10),\n description: faker.random.words(10),\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 const iModelHandlers: RequestHandler[] = mockMappings.map((mapping) =>\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/datasources/imodels/${\n mapping.mapping?._links?.imodel?.href ?? \"\"\n }/mappings/${mapping.mapping?.id}`,\n async (_req, res, ctx) => {\n return res(ctx.delay(), ctx.status(200), ctx.json(mapping));\n }\n )\n );\n\n return [mockMappings, iModelHandlers];\n};\n\nconst connectionMock = moq.Mock.ofType<IModelConnection>();\nconst selectionManagerMock = moq.Mock.ofType<SelectionManager>();\nconst selectionScopesManagerMock = moq.Mock.ofType<SelectionScopesManager>();\n\njest.mock(\"@itwin/appui-react\", () => ({\n ...jest.requireActual(\"@itwin/appui-react\"),\n useActiveIModelConnection: () => connectionMock.object,\n}));\n\nconst server = setupServer();\n\nbeforeAll(async () => {\n // This is required by the i18n module within iTwin.js\n (global as any).XMLHttpRequest = require(\"xmlhttprequest\").XMLHttpRequest; // eslint-disable-line @typescript-eslint/no-var-requires\n await NoRenderApp.startup();\n await Presentation.initialize();\n const selectionSet = moq.Mock.ofType<SelectionSet>();\n const onChanged = moq.Mock.ofType<BeEvent<(ev: SelectionSetEvent) => void>>();\n selectionSet.setup((x) => x.elements).returns(() => new Set([]));\n selectionSet.setup((x) => x.onChanged).returns(() => onChanged.object);\n connectionMock\n .setup((x) => x.selectionSet)\n .returns(() => selectionSet.object);\n connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId1);\n connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);\n\n selectionManagerMock\n .setup((x) => x.selectionChange)\n .returns(() => new SelectionChangeEvent());\n\n selectionScopesManagerMock\n .setup(async (x) => x.getSelectionScopes(connectionMock.object))\n .returns(async () => []);\n selectionManagerMock\n .setup((x) => x.scopes)\n .returns(() => selectionScopesManagerMock.object);\n\n Presentation.setSelectionManager(selectionManagerMock.object);\n await TestUtils.initializeUiFramework(connectionMock.object);\n await ReportsConfigWidget.initialize();\n server.listen();\n});\n\nafterAll(() => {\n TestUtils.terminateUiFramework();\n server.close();\n});\n\nafterEach(() => {\n server.resetHandlers();\n});\n\ndescribe(\"Report Mappings View\", () => {\n it(\"shows all report mappings\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const [mockMappings, iModelHandlers] =\n mockMappingsFactory(mockReportMappings);\n\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockReportMappings)\n );\n }\n ),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId1}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[0])\n );\n }\n ),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId2}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[1])\n );\n }\n ),\n ...iModelHandlers\n );\n\n render(<ReportMappings report={mockReport} goBack={jest.fn()} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const horizontalTiles = screen.getAllByTestId(\"horizontal-tile\");\n\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 it(\"search for a report mapping\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const [mockMappings, iModelHandlers] =\n mockMappingsFactory(mockReportMappings);\n\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockReportMappings)\n );\n }\n ),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId1}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[0])\n );\n }\n ),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId2}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[1])\n );\n }\n ),\n ...iModelHandlers\n );\n\n const { user } = render(\n <ReportMappings report={mockReport} goBack={jest.fn()} />\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const searchButton = within(screen.getByTestId(/search-bar/i)).getByRole(\n \"button\"\n );\n await user.click(searchButton);\n const searchInput = screen.getByRole(\"textbox\", {\n name: /search\\-textbox/i,\n });\n\n // Be an exact match on display name.\n await user.type(searchInput, mockMappings[0].mapping?.mappingName ?? \"\");\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(mockMappings[0].mapping?.mappingName ?? \"\")\n ).toBeInTheDocument();\n\n // Be an exact match on description.\n await user.clear(searchInput);\n await user.type(searchInput, mockMappings[0].mapping?.description ?? \"\");\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByTitle(mockMappings[0].mapping?.description ?? \"\")\n ).toBeInTheDocument();\n\n // Be an exact match on iModel Name.\n const iModel = mockIModelsResponse.find(\n (mockIModel) =>\n mockIModel.iModel.id === mockMappings[0].mapping?._links?.imodel?.href\n );\n await user.clear(searchInput);\n await user.type(searchInput, iModel?.iModel.displayName ?? \"\");\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(iModel?.iModel.displayName ?? \"\")\n ).toBeInTheDocument();\n });\n\n it(\"remove a report mapping\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const [_, iModelHandlers] = mockMappingsFactory(mockReportMappings);\n\n const mockReportMappingsOriginalSize = mockReportMappings.mappings!.length;\n\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockReportMappings)\n );\n }\n ),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId1}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[0])\n );\n }\n ),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId2}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[1])\n );\n }\n ),\n ...iModelHandlers,\n rest.delete(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings/${\n mockReportMappings.mappings![0].mappingId ?? \"\"\n }`,\n async (_req, res, ctx) => {\n mockReportMappings.mappings = mockReportMappings.mappings!.filter(\n (mapping) =>\n mapping.mappingId !== mockReportMappings.mappings![0].mappingId ??\n \"\"\n );\n return res(ctx.delay(100), ctx.status(204));\n }\n )\n );\n\n const { user } = render(\n <ReportMappings report={mockReport} goBack={jest.fn()} />\n );\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 mapping\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(\n mockReportMappingsOriginalSize - 1\n );\n });\n\n it(\"add mapping\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const [mockMappings, iModelHandlers] =\n mockMappingsFactory(mockReportMappings);\n\n // Adding an extra unmapped mapping.\n const extraMappingId = faker.datatype.uuid();\n const extraMappingName = faker.random.alpha(10);\n\n mockMappings.push({\n mapping: {\n id: extraMappingId,\n mappingName: extraMappingName,\n description: faker.random.words(10),\n extractionEnabled: false,\n createdOn: \"\",\n createdBy: \"\",\n modifiedOn: \"\",\n modifiedBy: \"\",\n _links: {\n imodel: {\n href: \"\",\n },\n },\n },\n });\n\n const mockMappingsResponse: MappingCollection = {\n // Type guarding\n mappings: mockMappings\n .map((mapping) => mapping.mapping)\n .filter((mapping): mapping is Mapping => !!mapping),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n };\n\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockReportMappings)\n );\n }\n ),\n rest.get(`${Constants.api.baseUrl}`, async (_req, res, ctx) => {\n return res(ctx.delay(), ctx.status(200), ctx.json(mockProjectIModels));\n }),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId1}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[0])\n );\n }\n ),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId2}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[1])\n );\n }\n ),\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/datasources/imodels/${mockProjectIModels.iModels[0].id}/mappings`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockMappingsResponse)\n );\n }\n ),\n rest.post(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockReportMappings)\n );\n }\n ),\n ...iModelHandlers\n );\n\n const { user } = render(\n <ReportMappings report={mockReport} goBack={jest.fn()} />\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const addMappingButton = screen.getByRole(\"button\", {\n name: /addmapping/i,\n });\n\n await user.click(addMappingButton);\n\n await waitForElementToBeRemoved(() =>\n screen.getByTestId(/rcw-action-loading-spinner/i)\n );\n // Add modal dialog should appear\n const modal = screen.getByRole(\"dialog\");\n expect(screen.getByRole(\"dialog\")).toBeInTheDocument();\n\n const withinModal = within(modal);\n expect(withinModal.getByText(/addmappings/i)).toBeInTheDocument();\n\n const addButton = withinModal.getByRole(\"button\", {\n name: /add/i,\n });\n // Add button should be disabled\n expect(addButton).toBeDisabled();\n\n // Already mapped mappings are disabled\n for (let i = 0; i < mockMappings.length - 1; i++) {\n const row = screen.getByRole(\"row\", {\n name: new RegExp(\n `toggle row selected ${mockMappings[i].mapping?.mappingName} ${mockMappings[i].mapping?.description}`,\n \"i\"\n ),\n });\n\n const checkbox = within(row).getByRole(\"checkbox\", {\n name: /toggle row selected/i,\n });\n expect(checkbox).toBeDisabled();\n }\n\n // Click on checkbox on new mapping\n const unmappedRow = screen.getByRole(\"row\", {\n name: new RegExp(\n `toggle row selected ${\n mockMappings[mockMappings.length - 1].mapping?.mappingName\n } ${mockMappings[mockMappings.length - 1].mapping?.description}`,\n \"i\"\n ),\n });\n\n const enabledCheckbox = within(unmappedRow).getByRole(\"checkbox\", {\n name: /toggle row selected/i,\n });\n\n await user.click(enabledCheckbox);\n\n await user.click(addButton);\n // Modal should go away\n await waitForElementToBeRemoved(() =>\n screen.getByTestId(/rcw-action-loading-spinner/i)\n );\n await waitForElementToBeRemoved(() => screen.getByRole(\"dialog\"));\n });\n\n it(\"odata feed url\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const [_, iModelHandlers] = mockMappingsFactory(mockReportMappings);\n\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockReportMappings)\n );\n }\n ),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId1}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[0])\n );\n }\n ),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId2}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[1])\n );\n }\n ),\n ...iModelHandlers\n );\n\n const { user } = render(\n <ReportMappings report={mockReport} goBack={jest.fn()} />\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const urlTextbox = screen.getByRole(\"textbox\", {\n name: /odatafeedurl/i,\n });\n expect(urlTextbox).toBeInTheDocument();\n expect(\n screen.getByDisplayValue(\n `https://api.bentley.com/insights/reporting/odata/${mockReport.id}`\n )\n ).toBeInTheDocument();\n\n const copyButton = screen.getByRole(\"button\", {\n name: /copy/i,\n });\n\n await user.click(copyButton);\n expect(screen.getByText(/copiedtoclipboard/i)).toBeInTheDocument();\n });\n\n it(\"full extraction\", async () => {\n const mockReportMappings = mockReportMappingsFactory();\n const [_, iModelHandlers] = mockMappingsFactory(mockReportMappings);\n\n const delay = REFRESH_DELAY;\n\n // Faking timers currently makes all promise based queries from RTL become unpredictable.\n // https://github.com/testing-library/dom-testing-library/issues/988\n // Should come back to this later.\n // Consequently, this test will be a bit slower.\n // jest.useFakeTimers()\n\n Element.prototype.scrollIntoView = jest.fn();\n\n const mockIModel = mockIModelsResponse[0].iModel;\n const mockRunId = faker.datatype.uuid();\n\n const mockExtractionResponse = {\n run: {\n id: mockRunId,\n _links: {\n status: {\n href: \"\",\n },\n },\n },\n };\n\n let mockStatusResponse: ExtractionStatus = {\n status: {\n state: \"Queued\",\n reason: \"\",\n },\n };\n\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockReportId}/datasources/imodelMappings`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockReportMappings)\n );\n }\n ),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId1}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[0])\n );\n }\n ),\n rest.get(\n `${Constants.api.baseUrl}/${mockIModelId2}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockIModelsResponse[1])\n );\n }\n ),\n ...iModelHandlers,\n rest.post(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/datasources/imodels/${mockIModel.id}/extraction/run`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockExtractionResponse)\n );\n }\n ),\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/datasources/extraction/status/${mockRunId}`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(),\n ctx.status(200),\n ctx.json(mockStatusResponse)\n );\n }\n )\n );\n\n render(<ReportMappings report={mockReport} goBack={jest.fn()} />);\n\n // https://github.com/testing-library/user-event/issues/833\n const user = userEvent.setup({ delay: null });\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const comboBox = screen.getByRole(\"combobox\", {\n name: /updatedataset/i,\n });\n await user.type(comboBox, mockIModel.displayName);\n\n const option = screen.getByRole(\"option\", {\n name: mockIModel.displayName,\n });\n\n await user.click(option);\n\n // Combobox should have correct status\n const extractionComponent = screen.getByTestId(\"extraction-combo-box\");\n expect(\n within(extractionComponent).getByDisplayValue(mockIModel.displayName)\n ).toBeInTheDocument();\n // Should be two in the document. One in the status and the other in the list.\n // TODO Assert that it is in the correct HorizontalTile\n expect(screen.getAllByTitle(/starting/i)).toHaveLength(2);\n\n const loadingStates = await screen.findAllByTitle(/loading/i);\n expect(loadingStates).toHaveLength(2);\n\n // act(() => {\n // jest.advanceTimersByTime(2000)\n // });\n const queuedStates = await screen.findAllByTitle(/queued/i, undefined, {\n timeout: delay,\n });\n expect(queuedStates).toHaveLength(2);\n\n mockStatusResponse = {\n status: {\n state: \"Running\",\n reason: \"\",\n },\n };\n\n const runningStates = await screen.findAllByTitle(/running/i, undefined, {\n timeout: delay,\n });\n expect(runningStates).toHaveLength(2);\n\n mockStatusResponse = {\n status: {\n state: \"Succeeded\",\n reason: \"\",\n },\n };\n\n const succeededStates = await screen.findAllByTitle(/success/i, undefined, {\n timeout: delay,\n });\n expect(succeededStates).toHaveLength(2);\n });\n});\n"]}
@@ -0,0 +1,2 @@
1
+ import "@testing-library/jest-dom";
2
+ //# sourceMappingURL=Reports.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Reports.test.d.ts","sourceRoot":"","sources":["../../../src/test/Reports.test.tsx"],"names":[],"mappings":"AAKA,OAAO,2BAA2B,CAAC"}