@cccsaurora/howler-ui 3.1.0-dev.1655 → 3.1.0-dev.1657

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 (354) hide show
  1. package/api/action/execute.test.d.ts +1 -0
  2. package/api/action/execute.test.js +38 -0
  3. package/api/action/index.test.d.ts +1 -0
  4. package/api/action/index.test.js +59 -0
  5. package/api/action/operations.test.d.ts +1 -0
  6. package/api/action/operations.test.js +23 -0
  7. package/api/analytic/comments/index.test.d.ts +1 -0
  8. package/api/analytic/comments/index.test.js +43 -0
  9. package/api/analytic/comments/react.test.d.ts +1 -0
  10. package/api/analytic/comments/react.test.js +27 -0
  11. package/api/analytic/favourite.test.d.ts +1 -0
  12. package/api/analytic/favourite.test.js +20 -0
  13. package/api/analytic/index.test.d.ts +1 -0
  14. package/api/analytic/index.test.js +54 -0
  15. package/api/analytic/notebooks/index.test.d.ts +1 -0
  16. package/api/analytic/notebooks/index.test.js +31 -0
  17. package/api/analytic/owner.test.d.ts +1 -0
  18. package/api/analytic/owner.test.js +25 -0
  19. package/api/auth/apikey.test.d.ts +1 -0
  20. package/api/auth/apikey.test.js +34 -0
  21. package/api/auth/index.test.d.ts +1 -0
  22. package/api/auth/index.test.js +21 -0
  23. package/api/auth/login.test.d.ts +1 -0
  24. package/api/auth/login.test.js +53 -0
  25. package/api/configs/index.test.d.ts +1 -0
  26. package/api/configs/index.test.js +22 -0
  27. package/api/dossier/index.test.d.ts +1 -0
  28. package/api/dossier/index.test.js +57 -0
  29. package/api/help.test.d.ts +1 -0
  30. package/api/help.test.js +25 -0
  31. package/api/hit/assign.test.d.ts +1 -0
  32. package/api/hit/assign.test.js +22 -0
  33. package/api/hit/comments/index.test.d.ts +1 -0
  34. package/api/hit/comments/index.test.js +47 -0
  35. package/api/hit/comments/react.test.d.ts +1 -0
  36. package/api/hit/comments/react.test.js +27 -0
  37. package/api/hit/index.test.d.ts +1 -0
  38. package/api/hit/index.test.js +49 -0
  39. package/api/hit/labels.test.d.ts +1 -0
  40. package/api/hit/labels.test.js +29 -0
  41. package/api/hit/overwrite.test.d.ts +1 -0
  42. package/api/hit/overwrite.test.js +23 -0
  43. package/api/hit/transition.test.d.ts +1 -0
  44. package/api/hit/transition.test.js +24 -0
  45. package/api/index.test.d.ts +1 -0
  46. package/api/index.test.js +137 -0
  47. package/api/notebook/environments.test.d.ts +1 -0
  48. package/api/notebook/environments.test.js +22 -0
  49. package/api/notebook/index.test.d.ts +1 -0
  50. package/api/notebook/index.test.js +28 -0
  51. package/api/overview/index.test.d.ts +1 -0
  52. package/api/overview/index.test.js +42 -0
  53. package/api/search/fields/index.test.d.ts +1 -0
  54. package/api/search/fields/index.test.js +31 -0
  55. package/api/search/grouped/index.test.d.ts +1 -0
  56. package/api/search/grouped/index.test.js +18 -0
  57. package/api/search/grouped/user.test.d.ts +1 -0
  58. package/api/search/grouped/user.test.js +33 -0
  59. package/api/search/index.test.d.ts +1 -0
  60. package/api/search/index.test.js +41 -0
  61. package/api/search/user.test.d.ts +1 -0
  62. package/api/search/user.test.js +41 -0
  63. package/api/socket/index.test.d.ts +1 -0
  64. package/api/socket/index.test.js +15 -0
  65. package/api/template/index.test.d.ts +1 -0
  66. package/api/template/index.test.js +43 -0
  67. package/api/user/avatar/index.test.d.ts +1 -0
  68. package/api/user/avatar/index.test.js +22 -0
  69. package/api/user/groups.test.d.ts +1 -0
  70. package/api/user/groups.test.js +22 -0
  71. package/api/user/index.test.d.ts +1 -0
  72. package/api/user/index.test.js +37 -0
  73. package/api/user/whoami.test.d.ts +1 -0
  74. package/api/user/whoami.test.js +26 -0
  75. package/api/utils/createPermissionsApi.test.d.ts +1 -0
  76. package/api/utils/createPermissionsApi.test.js +30 -0
  77. package/api/v2/case/index.test.d.ts +1 -0
  78. package/api/v2/case/index.test.js +57 -0
  79. package/api/v2/case/items.test.d.ts +1 -0
  80. package/api/v2/case/items.test.js +37 -0
  81. package/api/v2/case/rules.test.d.ts +1 -0
  82. package/api/v2/case/rules.test.js +33 -0
  83. package/api/v2/fuzzy.test.d.ts +1 -0
  84. package/api/v2/fuzzy.test.js +30 -0
  85. package/api/v2/index.test.d.ts +1 -0
  86. package/api/v2/index.test.js +13 -0
  87. package/api/v2/search/index.test.d.ts +1 -0
  88. package/api/v2/search/index.test.js +42 -0
  89. package/api/view/index.test.d.ts +1 -0
  90. package/api/view/index.test.js +54 -0
  91. package/branding/AppBrand.test.d.ts +1 -0
  92. package/branding/AppBrand.test.js +29 -0
  93. package/components/app/drawers/ApiKeyDrawer.test.d.ts +1 -0
  94. package/components/app/drawers/ApiKeyDrawer.test.js +119 -0
  95. package/components/app/drawers/AssignUserDrawer.test.d.ts +1 -0
  96. package/components/app/drawers/AssignUserDrawer.test.js +75 -0
  97. package/components/app/hooks/useTitle.test.d.ts +1 -0
  98. package/components/app/hooks/useTitle.test.js +103 -0
  99. package/components/app/providers/AnalyticProvider.test.d.ts +1 -0
  100. package/components/app/providers/AnalyticProvider.test.js +58 -0
  101. package/components/app/providers/AppBarProvider.test.d.ts +1 -0
  102. package/components/app/providers/AppBarProvider.test.js +23 -0
  103. package/components/app/providers/AppDrawerProvider.test.d.ts +1 -0
  104. package/components/app/providers/AppDrawerProvider.test.js +42 -0
  105. package/components/app/providers/AvatarProvider.test.d.ts +1 -0
  106. package/components/app/providers/AvatarProvider.test.js +50 -0
  107. package/components/app/providers/CustomPluginProvider.test.d.ts +1 -0
  108. package/components/app/providers/CustomPluginProvider.test.js +29 -0
  109. package/components/app/providers/FavouritesProvider.test.d.ts +1 -0
  110. package/components/app/providers/FavouritesProvider.test.js +115 -0
  111. package/components/app/providers/FieldProvider.test.d.ts +1 -0
  112. package/components/app/providers/FieldProvider.test.js +28 -0
  113. package/components/app/providers/LocalStorageProvider.test.d.ts +1 -0
  114. package/components/app/providers/LocalStorageProvider.test.js +42 -0
  115. package/components/app/providers/ModalProvider.test.d.ts +1 -0
  116. package/components/app/providers/ModalProvider.test.js +35 -0
  117. package/components/app/providers/OverviewProvider.test.d.ts +1 -0
  118. package/components/app/providers/OverviewProvider.test.js +62 -0
  119. package/components/app/providers/RecordProvider.test.d.ts +1 -0
  120. package/components/app/providers/RecordProvider.test.js +66 -0
  121. package/components/app/providers/contextUtils.test.d.ts +1 -0
  122. package/components/app/providers/contextUtils.test.js +8 -0
  123. package/components/elements/Comment.test.d.ts +1 -0
  124. package/components/elements/Comment.test.js +109 -0
  125. package/components/elements/EditRow.test.d.ts +1 -0
  126. package/components/elements/EditRow.test.js +88 -0
  127. package/components/elements/MarkdownEditor.test.d.ts +1 -0
  128. package/components/elements/MarkdownEditor.test.js +75 -0
  129. package/components/elements/ObjectDetails.test.d.ts +1 -0
  130. package/components/elements/ObjectDetails.test.js +70 -0
  131. package/components/elements/PluginChip.d.ts +3 -2
  132. package/components/elements/PluginChip.js +2 -2
  133. package/components/elements/PluginChip.test.d.ts +1 -0
  134. package/components/elements/PluginChip.test.js +30 -0
  135. package/components/elements/ThemedEditor.test.d.ts +1 -0
  136. package/components/elements/ThemedEditor.test.js +66 -0
  137. package/components/elements/addons/layout/FlexPort.test.d.ts +1 -0
  138. package/components/elements/addons/layout/FlexPort.test.js +34 -0
  139. package/components/elements/addons/lists/TuiListBase.test.d.ts +1 -0
  140. package/components/elements/addons/lists/TuiListBase.test.js +44 -0
  141. package/components/elements/addons/lists/TuiListProvider.test.d.ts +1 -0
  142. package/components/elements/addons/lists/TuiListProvider.test.js +50 -0
  143. package/components/elements/addons/search/phrase/Phrase.test.d.ts +1 -0
  144. package/components/elements/addons/search/phrase/Phrase.test.js +77 -0
  145. package/components/elements/addons/search/phrase/PhraseLexer.test.d.ts +1 -0
  146. package/components/elements/addons/search/phrase/PhraseLexer.test.js +92 -0
  147. package/components/elements/addons/search/phrase/index.test.d.ts +1 -0
  148. package/components/elements/addons/search/phrase/index.test.js +20 -0
  149. package/components/elements/case/CaseCard.test.d.ts +1 -0
  150. package/components/elements/case/CaseCard.test.js +107 -0
  151. package/components/elements/display/ClassificationChip.test.d.ts +1 -0
  152. package/components/elements/display/ClassificationChip.test.js +60 -0
  153. package/components/elements/display/HandlebarsMarkdown.test.d.ts +1 -0
  154. package/components/elements/display/HandlebarsMarkdown.test.js +41 -0
  155. package/components/elements/display/HowlerAvatar.test.d.ts +1 -0
  156. package/components/elements/display/HowlerAvatar.test.js +54 -0
  157. package/components/elements/display/ItemManager.test.d.ts +1 -0
  158. package/components/elements/display/ItemManager.test.js +68 -0
  159. package/components/elements/display/UserPageWrapper.test.d.ts +1 -0
  160. package/components/elements/display/UserPageWrapper.test.js +22 -0
  161. package/components/elements/display/handlebars/helpers.test.d.ts +1 -0
  162. package/components/elements/display/handlebars/helpers.test.js +104 -0
  163. package/components/elements/display/icons/SocketBadge.test.d.ts +1 -0
  164. package/components/elements/display/icons/SocketBadge.test.js +49 -0
  165. package/components/elements/display/markdownPlugins/tabs.test.d.ts +1 -0
  166. package/components/elements/display/markdownPlugins/tabs.test.js +50 -0
  167. package/components/elements/hit/HitActions.js +1 -1
  168. package/components/elements/hit/HitActions.test.d.ts +1 -0
  169. package/components/elements/hit/HitActions.test.js +166 -0
  170. package/components/elements/hit/HitLabels.test.js +34 -3
  171. package/components/elements/hit/HitNotebooks.test.d.ts +1 -0
  172. package/components/elements/hit/HitNotebooks.test.js +138 -0
  173. package/components/elements/hit/HitSummary.test.d.ts +1 -0
  174. package/components/elements/hit/HitSummary.test.js +188 -0
  175. package/components/elements/hit/actions/ButtonActions.test.d.ts +1 -0
  176. package/components/elements/hit/actions/ButtonActions.test.js +51 -0
  177. package/components/elements/hit/actions/DropdownActions.test.d.ts +1 -0
  178. package/components/elements/hit/actions/DropdownActions.test.js +60 -0
  179. package/components/elements/hit/grid/AddColumnModal.test.d.ts +1 -0
  180. package/components/elements/hit/grid/AddColumnModal.test.js +88 -0
  181. package/components/elements/hit/grid/RecordTable.test.d.ts +1 -0
  182. package/components/elements/hit/grid/RecordTable.test.js +99 -0
  183. package/components/elements/record/RecordComments.test.d.ts +1 -0
  184. package/components/elements/record/RecordComments.test.js +151 -0
  185. package/components/elements/record/RecordContextMenu.js +3 -3
  186. package/components/elements/record/RecordRelated.test.d.ts +1 -0
  187. package/components/elements/record/RecordRelated.test.js +77 -0
  188. package/components/elements/record/RecordWorklog.test.d.ts +1 -0
  189. package/components/elements/record/RecordWorklog.test.js +77 -0
  190. package/components/hooks/useHitActions.test.d.ts +1 -0
  191. package/components/hooks/useHitActions.test.js +189 -0
  192. package/components/hooks/useMyApi.test.d.ts +1 -0
  193. package/components/hooks/useMyApi.test.js +31 -0
  194. package/components/hooks/useMyChart.test.d.ts +1 -0
  195. package/components/hooks/useMyChart.test.js +62 -0
  196. package/components/hooks/useMySearch.test.d.ts +1 -0
  197. package/components/hooks/useMySearch.test.js +96 -0
  198. package/components/hooks/useMySnackbar.test.d.ts +1 -0
  199. package/components/hooks/useMySnackbar.test.js +36 -0
  200. package/components/hooks/useMyUserFunctions.test.d.ts +1 -0
  201. package/components/hooks/useMyUserFunctions.test.js +142 -0
  202. package/components/hooks/useRecordSelection.test.d.ts +1 -0
  203. package/components/hooks/useRecordSelection.test.js +102 -0
  204. package/components/logins/Login.test.d.ts +1 -0
  205. package/components/logins/Login.test.js +67 -0
  206. package/components/logins/hooks/useLogin.test.d.ts +1 -0
  207. package/components/logins/hooks/useLogin.test.js +142 -0
  208. package/components/routes/action/shared/OperationEntry.test.d.ts +1 -0
  209. package/components/routes/action/shared/OperationEntry.test.js +80 -0
  210. package/components/routes/action/shared/OperationStep.test.d.ts +1 -0
  211. package/components/routes/action/shared/OperationStep.test.js +84 -0
  212. package/components/routes/action/useMyActionFunctions.test.d.ts +1 -0
  213. package/components/routes/action/useMyActionFunctions.test.js +217 -0
  214. package/components/routes/action/view/ActionDetails.test.d.ts +1 -0
  215. package/components/routes/action/view/ActionDetails.test.js +170 -0
  216. package/components/routes/action/view/ActionSearch.test.d.ts +1 -0
  217. package/components/routes/action/view/ActionSearch.test.js +185 -0
  218. package/components/routes/action/view/Integrations.test.d.ts +1 -0
  219. package/components/routes/action/view/Integrations.test.js +62 -0
  220. package/components/routes/admin/users/UserEditor.test.d.ts +1 -0
  221. package/components/routes/admin/users/UserEditor.test.js +74 -0
  222. package/components/routes/admin/users/UserSearch.test.d.ts +1 -0
  223. package/components/routes/admin/users/UserSearch.test.js +146 -0
  224. package/components/routes/advanced/QueryBuilder.test.d.ts +1 -0
  225. package/components/routes/advanced/QueryBuilder.test.js +185 -0
  226. package/components/routes/advanced/QueryEditor.test.d.ts +1 -0
  227. package/components/routes/advanced/QueryEditor.test.js +130 -0
  228. package/components/routes/advanced/completionProviders.test.d.ts +1 -0
  229. package/components/routes/advanced/completionProviders.test.js +144 -0
  230. package/components/routes/analytics/AnalyticComments.test.d.ts +1 -0
  231. package/components/routes/analytics/AnalyticComments.test.js +156 -0
  232. package/components/routes/analytics/AnalyticDetails.test.d.ts +1 -0
  233. package/components/routes/analytics/AnalyticDetails.test.js +161 -0
  234. package/components/routes/analytics/AnalyticNotebooks.test.d.ts +1 -0
  235. package/components/routes/analytics/AnalyticNotebooks.test.js +112 -0
  236. package/components/routes/analytics/AnalyticOverview.test.d.ts +1 -0
  237. package/components/routes/analytics/AnalyticOverview.test.js +97 -0
  238. package/components/routes/analytics/AnalyticOverviews.test.d.ts +1 -0
  239. package/components/routes/analytics/AnalyticOverviews.test.js +70 -0
  240. package/components/routes/analytics/AnalyticSearch.test.d.ts +1 -0
  241. package/components/routes/analytics/AnalyticSearch.test.js +167 -0
  242. package/components/routes/analytics/AnalyticTemplates.test.d.ts +1 -0
  243. package/components/routes/analytics/AnalyticTemplates.test.js +63 -0
  244. package/components/routes/analytics/TriageSettings.test.d.ts +1 -0
  245. package/components/routes/analytics/TriageSettings.test.js +89 -0
  246. package/components/routes/analytics/widgets/Assessment.test.d.ts +1 -0
  247. package/components/routes/analytics/widgets/Assessment.test.js +45 -0
  248. package/components/routes/analytics/widgets/Created.test.d.ts +1 -0
  249. package/components/routes/analytics/widgets/Created.test.js +41 -0
  250. package/components/routes/analytics/widgets/DetectionStatus.test.d.ts +1 -0
  251. package/components/routes/analytics/widgets/DetectionStatus.test.js +21 -0
  252. package/components/routes/analytics/widgets/Stacked.test.d.ts +1 -0
  253. package/components/routes/analytics/widgets/Stacked.test.js +51 -0
  254. package/components/routes/cases/Cases.test.d.ts +1 -0
  255. package/components/routes/cases/Cases.test.js +132 -0
  256. package/components/routes/dossiers/Dossiers.test.d.ts +1 -0
  257. package/components/routes/dossiers/Dossiers.test.js +150 -0
  258. package/components/routes/help/ActionDocumentation.test.d.ts +1 -0
  259. package/components/routes/help/ActionDocumentation.test.js +58 -0
  260. package/components/routes/help/ActionIntroductionDocumentation.test.d.ts +1 -0
  261. package/components/routes/help/ActionIntroductionDocumentation.test.js +68 -0
  262. package/components/routes/help/ApiDocumentation.test.d.ts +1 -0
  263. package/components/routes/help/ApiDocumentation.test.js +79 -0
  264. package/components/routes/help/AuthDocumentation.test.d.ts +1 -0
  265. package/components/routes/help/AuthDocumentation.test.js +34 -0
  266. package/components/routes/help/ClientDocumentation.test.d.ts +1 -0
  267. package/components/routes/help/ClientDocumentation.test.js +34 -0
  268. package/components/routes/help/Help.test.d.ts +1 -0
  269. package/components/routes/help/Help.test.js +57 -0
  270. package/components/routes/help/HitBannerDocumentation.test.d.ts +1 -0
  271. package/components/routes/help/HitBannerDocumentation.test.js +25 -0
  272. package/components/routes/help/HitDocumentation.test.d.ts +1 -0
  273. package/components/routes/help/HitDocumentation.test.js +53 -0
  274. package/components/routes/help/HitLabelsDocumentation.test.d.ts +1 -0
  275. package/components/routes/help/HitLabelsDocumentation.test.js +17 -0
  276. package/components/routes/help/HitLinksDocumentation.test.d.ts +1 -0
  277. package/components/routes/help/HitLinksDocumentation.test.js +27 -0
  278. package/components/routes/help/HitSchemaDocumentation.test.d.ts +1 -0
  279. package/components/routes/help/HitSchemaDocumentation.test.js +67 -0
  280. package/components/routes/help/NotebookDocumentation.test.d.ts +1 -0
  281. package/components/routes/help/NotebookDocumentation.test.js +34 -0
  282. package/components/routes/help/OverviewDocumentation.test.d.ts +1 -0
  283. package/components/routes/help/OverviewDocumentation.test.js +26 -0
  284. package/components/routes/help/RetentionDocumentation.test.d.ts +1 -0
  285. package/components/routes/help/RetentionDocumentation.test.js +61 -0
  286. package/components/routes/help/SearchDocumentation.test.d.ts +1 -0
  287. package/components/routes/help/SearchDocumentation.test.js +65 -0
  288. package/components/routes/help/TemplateDocumentation.test.d.ts +1 -0
  289. package/components/routes/help/TemplateDocumentation.test.js +58 -0
  290. package/components/routes/help/ViewDocumentation.test.d.ts +1 -0
  291. package/components/routes/help/ViewDocumentation.test.js +34 -0
  292. package/components/routes/help/components/HelpTabs.test.d.ts +1 -0
  293. package/components/routes/help/components/HelpTabs.test.js +26 -0
  294. package/components/routes/hits/search/InformationPane.test.d.ts +1 -0
  295. package/components/routes/hits/search/InformationPane.test.js +251 -0
  296. package/components/routes/hits/search/RecordBrowser.test.js +179 -51
  297. package/components/routes/hits/search/RecordQuery.test.d.ts +1 -0
  298. package/components/routes/hits/search/RecordQuery.test.js +117 -0
  299. package/components/routes/hits/search/SearchPane.test.d.ts +1 -0
  300. package/components/routes/hits/search/SearchPane.test.js +178 -0
  301. package/components/routes/hits/search/grid/RecordGrid.test.d.ts +1 -0
  302. package/components/routes/hits/search/grid/RecordGrid.test.js +107 -0
  303. package/components/routes/hits/search/shared/CustomSort.test.d.ts +1 -0
  304. package/components/routes/hits/search/shared/CustomSort.test.js +77 -0
  305. package/components/routes/hits/search/shared/HitFilter.test.d.ts +1 -0
  306. package/components/routes/hits/search/shared/HitFilter.test.js +83 -0
  307. package/components/routes/hits/search/shared/HitSort.test.d.ts +1 -0
  308. package/components/routes/hits/search/shared/HitSort.test.js +61 -0
  309. package/components/routes/hits/search/shared/LayoutSettings.test.d.ts +1 -0
  310. package/components/routes/hits/search/shared/LayoutSettings.test.js +84 -0
  311. package/components/routes/hits/search/shared/SearchSpan.test.d.ts +1 -0
  312. package/components/routes/hits/search/shared/SearchSpan.test.js +84 -0
  313. package/components/routes/home/AnalyticCard.test.d.ts +1 -0
  314. package/components/routes/home/AnalyticCard.test.js +87 -0
  315. package/components/routes/home/index.test.d.ts +1 -0
  316. package/components/routes/home/index.test.js +190 -0
  317. package/components/routes/overviews/OverviewViewer.test.d.ts +1 -0
  318. package/components/routes/overviews/OverviewViewer.test.js +151 -0
  319. package/components/routes/overviews/Overviews.test.d.ts +1 -0
  320. package/components/routes/overviews/Overviews.test.js +154 -0
  321. package/components/routes/settings/AdminSection.test.d.ts +1 -0
  322. package/components/routes/settings/AdminSection.test.js +26 -0
  323. package/components/routes/settings/LocalSection.test.d.ts +1 -0
  324. package/components/routes/settings/LocalSection.test.js +75 -0
  325. package/components/routes/settings/ProfileSection.test.d.ts +1 -0
  326. package/components/routes/settings/ProfileSection.test.js +95 -0
  327. package/components/routes/settings/SecuritySection.test.d.ts +1 -0
  328. package/components/routes/settings/SecuritySection.test.js +90 -0
  329. package/components/routes/settings/Settings.test.d.ts +1 -0
  330. package/components/routes/settings/Settings.test.js +60 -0
  331. package/components/routes/templates/TemplateEditor.test.d.ts +1 -0
  332. package/components/routes/templates/TemplateEditor.test.js +94 -0
  333. package/components/routes/templates/TemplateViewer.test.d.ts +1 -0
  334. package/components/routes/templates/TemplateViewer.test.js +145 -0
  335. package/components/routes/templates/Templates.test.d.ts +1 -0
  336. package/components/routes/templates/Templates.test.js +165 -0
  337. package/components/routes/views/ViewComposer.test.d.ts +1 -0
  338. package/components/routes/views/ViewComposer.test.js +320 -0
  339. package/components/routes/views/Views.test.d.ts +1 -0
  340. package/components/routes/views/Views.test.js +247 -0
  341. package/package.json +1 -1
  342. package/plugins/HowlerPlugin.test.d.ts +1 -0
  343. package/plugins/HowlerPlugin.test.js +103 -0
  344. package/plugins/clue/components/ClueChip.js +2 -2
  345. package/plugins/clue/helpers.test.d.ts +1 -0
  346. package/plugins/clue/helpers.test.js +100 -0
  347. package/plugins/store.test.d.ts +1 -0
  348. package/plugins/store.test.js +53 -0
  349. package/utils/classificationParser.test.d.ts +1 -0
  350. package/utils/classificationParser.test.js +199 -0
  351. package/utils/constants.test.d.ts +1 -0
  352. package/utils/constants.test.js +62 -0
  353. package/utils/typeUtils.test.d.ts +1 -0
  354. package/utils/typeUtils.test.js +22 -0
@@ -1,6 +1,6 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { Chip } from '@mui/material';
3
2
  import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
3
+ import { createElement } from 'react';
4
4
  import { usePluginStore } from 'react-pluggable';
5
5
  const PluginChip = ({ children, value, context, field, hit, ...props }) => {
6
6
  const pluginStore = usePluginStore();
@@ -17,6 +17,6 @@ const PluginChip = ({ children, value, context, field, hit, ...props }) => {
17
17
  return component;
18
18
  }
19
19
  }
20
- return _jsx(Chip, { ...props, children: children });
20
+ return createElement(Chip, { ...props, children });
21
21
  };
22
22
  export default PluginChip;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /// <reference types="vitest" />
3
+ import { render, screen } from '@testing-library/react';
4
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
5
+ const mockExecuteFunction = vi.hoisted(() => vi.fn());
6
+ vi.mock('@mui/material', () => ({
7
+ Chip: ({ children }) => _jsx("div", { children: `fallback:${children}` })
8
+ }));
9
+ vi.mock('plugins/store', () => ({
10
+ default: { plugins: ['plugin-a', 'plugin-b'] }
11
+ }));
12
+ vi.mock('react-pluggable', () => ({
13
+ usePluginStore: () => ({ executeFunction: mockExecuteFunction })
14
+ }));
15
+ import PluginChip from './PluginChip';
16
+ describe('PluginChip', () => {
17
+ beforeEach(() => {
18
+ mockExecuteFunction.mockReset();
19
+ });
20
+ it('renders the first plugin-provided chip component', () => {
21
+ mockExecuteFunction.mockImplementation((name) => name === 'plugin-b.chip' ? _jsx("div", { children: "plugin-chip" }) : null);
22
+ render(_jsx(PluginChip, { value: "v", context: "ctx", children: "child" }));
23
+ expect(screen.getByText('plugin-chip')).toBeInTheDocument();
24
+ });
25
+ it('falls back to the default MUI chip when no plugin handles the value', () => {
26
+ mockExecuteFunction.mockReturnValue(null);
27
+ render(_jsx(PluginChip, { value: "v", context: "ctx", children: "child" }));
28
+ expect(screen.getByText('fallback:child')).toBeInTheDocument();
29
+ });
30
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /// <reference types="vitest" />
3
+ import { render } from '@testing-library/react';
4
+ import { describe, expect, it, vi } from 'vitest';
5
+ const mockDefineTheme = vi.hoisted(() => vi.fn());
6
+ const mockRegisterLanguage = vi.hoisted(() => vi.fn());
7
+ const mockSetTheme = vi.hoisted(() => vi.fn());
8
+ const capturedProps = vi.hoisted(() => ({ current: null }));
9
+ let themeMode = 'light';
10
+ let monacoValue = null;
11
+ vi.mock('@monaco-editor/react', () => ({
12
+ Editor: (props) => {
13
+ capturedProps.current = props;
14
+ return _jsx("div", { children: "editor" });
15
+ },
16
+ useMonaco: () => monacoValue
17
+ }));
18
+ vi.mock('@mui/material', () => ({
19
+ useTheme: () => ({ palette: { mode: themeMode, background: { paper: themeMode === 'light' ? '#fff' : '#111' } } })
20
+ }));
21
+ vi.mock('@tui/core', () => ({
22
+ useAppTheme: () => ({ current: 'default', optionsOverride: { dense: true } }),
23
+ useAppThemeBuilder: () => () => ({
24
+ lightTheme: {
25
+ palette: {
26
+ background: { paper: '#fff' },
27
+ warning: { dark: '#abc', light: '#def' },
28
+ error: { main: '#123456' },
29
+ success: { main: '#654321' }
30
+ }
31
+ },
32
+ darkTheme: {
33
+ palette: {
34
+ background: { paper: '#111' },
35
+ warning: { dark: '#aaa', light: '#bbb' },
36
+ error: { main: '#222222' },
37
+ success: { main: '#333333' }
38
+ }
39
+ }
40
+ })
41
+ }));
42
+ import ThemedEditor from './ThemedEditor';
43
+ describe('ThemedEditor', () => {
44
+ it('defines custom monaco themes and merges editor options', () => {
45
+ monacoValue = { editor: { setTheme: mockSetTheme } };
46
+ render(_jsx(ThemedEditor, { id: "the-editor", options: { readOnly: true }, beforeMount: vi.fn(), value: "x" }));
47
+ const fakeMonaco = {
48
+ editor: { defineTheme: mockDefineTheme },
49
+ languages: { register: mockRegisterLanguage }
50
+ };
51
+ capturedProps.current.beforeMount(fakeMonaco);
52
+ expect(mockDefineTheme).toHaveBeenCalledWith('howler', expect.objectContaining({ colors: { 'editor.background': '#ffffff' } }));
53
+ expect(mockDefineTheme).toHaveBeenCalledWith('howler-dark', expect.objectContaining({ colors: { 'editor.background': '#111111' } }));
54
+ expect(mockRegisterLanguage).toHaveBeenCalledWith({ id: 'lucene' });
55
+ expect(capturedProps.current.wrapperProps).toEqual({ id: 'the-editor' });
56
+ expect(capturedProps.current.options).toMatchObject({ readOnly: true, automaticLayout: true });
57
+ expect(mockSetTheme).toHaveBeenCalledWith('howler');
58
+ });
59
+ it('switches to the dark theme when the mui theme changes', () => {
60
+ themeMode = 'dark';
61
+ monacoValue = { editor: { setTheme: mockSetTheme } };
62
+ render(_jsx(ThemedEditor, { value: "x" }));
63
+ expect(capturedProps.current.theme).toBe('howler-dark');
64
+ expect(mockSetTheme).toHaveBeenCalledWith('howler-dark');
65
+ });
66
+ });
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /// <reference types="vitest" />
3
+ import { render, screen } from '@testing-library/react';
4
+ import { describe, expect, it, vi } from 'vitest';
5
+ vi.mock('@tui/core', () => ({
6
+ usePageProps: ({ props }) => ({
7
+ className: 'page-class',
8
+ style: {
9
+ marginBottom: `${props.mb ?? 0}px`,
10
+ marginLeft: `${props.ml ?? 0}px`,
11
+ marginRight: `${props.mr ?? 0}px`,
12
+ marginTop: `${props.mt ?? 0}px`
13
+ }
14
+ })
15
+ }));
16
+ import FlexPort from './FlexPort';
17
+ describe('FlexPort', () => {
18
+ it('renders page props margins and default overflow', () => {
19
+ render(_jsx(FlexPort, { id: "content", mt: 1, mr: 2, mb: 3, ml: 4, children: _jsx("div", { children: "child" }) }));
20
+ const inner = screen.getByText('child').parentElement;
21
+ const outer = inner.parentElement;
22
+ expect(outer.className).toBe('page-class');
23
+ expect(outer.style.marginTop).toBe('1px');
24
+ expect(outer.style.marginRight).toBe('2px');
25
+ expect(outer.style.marginBottom).toBe('3px');
26
+ expect(outer.style.marginLeft).toBe('4px');
27
+ expect(inner).toHaveAttribute('id', 'content');
28
+ expect(inner.style.overflow).toBe('auto');
29
+ });
30
+ it('omits overflow when disableOverflow is true', () => {
31
+ render(_jsx(FlexPort, { disableOverflow: true, children: _jsx("div", { children: "child" }) }));
32
+ expect(screen.getByText('child').parentElement.style.overflow).toBe('');
33
+ });
34
+ });
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /// <reference types="vitest" />
3
+ import { render, screen } from '@testing-library/react';
4
+ import { describe, expect, it, vi } from 'vitest';
5
+ const registerSpy = vi.hoisted(() => vi.fn(() => vi.fn()));
6
+ vi.mock('@mui/material', () => ({
7
+ emphasize: (_color, value) => `emphasis-${value}`,
8
+ styled: (tag) => (styles) => {
9
+ styles({
10
+ theme: {
11
+ palette: { background: { default: '#fff' }, text: { disabled: '#999' } }
12
+ }
13
+ });
14
+ return tag;
15
+ }
16
+ }));
17
+ vi.mock('@tui/core', () => ({
18
+ useAppBar: () => ({ autoHide: true }),
19
+ useAppBarHeight: () => 42,
20
+ useAppLayout: () => ({ current: 'wide' })
21
+ }));
22
+ vi.mock('components/elements/addons/lists/hooks/useTuiListKeyboard', () => ({
23
+ default: () => ({ register: registerSpy })
24
+ }));
25
+ import TuiListBase from './TuiListBase';
26
+ import { TuiListItemsContext, TuiListMethodContext } from './TuiListProvider';
27
+ describe('TuiListBase', () => {
28
+ it('renders items, exposes layout metadata, and forwards selection', () => {
29
+ const onSelect = vi.fn();
30
+ const select = vi.fn(item => ({ ...item, selected: !item.selected, cursor: true }));
31
+ render(_jsx(TuiListMethodContext.Provider, { value: { select }, children: _jsx(TuiListItemsContext.Provider, { value: { items: [{ id: '1', item: 'one', selected: false, cursor: false }] }, children: _jsx(TuiListBase, { onSelect: onSelect, children: (items, handleSelect) => (_jsxs("div", { children: [_jsx("button", { onClick: () => handleSelect(items[0], 0), children: "pick" }), _jsx("div", { children: items[0].item })] })) }) }) }));
32
+ const root = screen.getByText('one').closest('[data-tuiappbar-height]');
33
+ expect(root).toHaveAttribute('data-tuiappbar-height', '42');
34
+ expect(root).toHaveAttribute('data-tuilayout', 'wide');
35
+ expect(root).toHaveAttribute('data-tuiappbar-autohide', 'true');
36
+ screen.getByText('pick').click();
37
+ expect(select).toHaveBeenCalledWith({ id: '1', item: 'one', selected: false, cursor: false }, 0);
38
+ expect(onSelect).toHaveBeenCalledWith({ id: '1', item: 'one', selected: true, cursor: true }, 0);
39
+ });
40
+ it('registers keyboard handlers when keyboard mode is enabled', () => {
41
+ render(_jsx(TuiListMethodContext.Provider, { value: { select: vi.fn(item => item) }, children: _jsx(TuiListItemsContext.Provider, { value: { items: [] }, children: _jsx(TuiListBase, { keyboard: true, onSelect: vi.fn(), children: () => _jsx("div", { children: "content" }) }) }) }));
42
+ expect(registerSpy).toHaveBeenCalled();
43
+ });
44
+ });
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /// <reference types="vitest" />
3
+ import { fireEvent, render, screen } from '@testing-library/react';
4
+ import { useContext } from 'react';
5
+ import { describe, expect, it } from 'vitest';
6
+ import TuiListProvider, { TuiListItemsContext, TuiListMethodContext } from './TuiListProvider';
7
+ const Probe = () => {
8
+ const methods = useContext(TuiListMethodContext);
9
+ const { items, moveNext, movePrevious } = useContext(TuiListItemsContext);
10
+ return (_jsxs("div", { children: [_jsx("button", { onClick: () => methods.load([{ id: '1', item: 'one', selected: false, cursor: false }]), children: "load-one" }), _jsx("button", { onClick: () => methods.load([
11
+ {
12
+ id: '1',
13
+ item: 'updated',
14
+ selected: undefined,
15
+ cursor: undefined,
16
+ details: undefined
17
+ },
18
+ { id: '2', item: 'two', selected: false, cursor: false }
19
+ ]), children: "merge-load" }), _jsx("button", { onClick: () => methods.load([
20
+ { id: '1', item: 'one', selected: false, cursor: false },
21
+ { id: '2', item: 'two', selected: false, cursor: false }
22
+ ]), children: "load-two" }), _jsx("button", { onClick: () => methods.select(items[0], 0), children: "select-first" }), _jsx("button", { onClick: () => methods.move(1), children: "move-second" }), _jsx("button", { onClick: () => methods.replace(items[0], { id: '1', item: 'replace-ref', details: 'details' }), children: "replace-ref" }), _jsx("button", { onClick: () => methods.replaceById({ id: '2' }, { id: '2', item: 'replace-id' }), children: "replace-id" }), _jsx("button", { onClick: () => methods.remove('1'), children: "remove-first" }), _jsx("button", { onClick: () => moveNext(), children: "move-next" }), _jsx("button", { onClick: () => movePrevious(), children: "move-previous" }), _jsx("pre", { children: JSON.stringify(items) })] }));
23
+ };
24
+ describe('TuiListProvider', () => {
25
+ it('loads, preserves state, selects, moves, replaces, and removes items', () => {
26
+ render(_jsx(TuiListProvider, { children: _jsx(Probe, {}) }));
27
+ fireEvent.click(screen.getByText('load-one'));
28
+ expect(screen.getByText('[{"id":"1","item":"one","selected":false,"cursor":false}]')).toBeInTheDocument();
29
+ fireEvent.click(screen.getByText('select-first'));
30
+ expect(screen.getByText('[{"id":"1","item":"one","selected":true,"cursor":true}]')).toBeInTheDocument();
31
+ fireEvent.click(screen.getByText('merge-load'));
32
+ expect(screen.getByText('[{"id":"1","item":"updated","selected":true,"cursor":true},{"id":"2","item":"two","selected":false,"cursor":false}]')).toBeInTheDocument();
33
+ fireEvent.click(screen.getByText('replace-ref'));
34
+ expect(screen.getByText('[{"id":"1","item":"replace-ref","selected":true,"cursor":true,"details":"details"},{"id":"2","item":"two","selected":false,"cursor":false}]')).toBeInTheDocument();
35
+ fireEvent.click(screen.getByText('replace-id'));
36
+ expect(screen.getByText('[{"id":"1","item":"replace-ref","selected":true,"cursor":true,"details":"details"},{"id":"2","item":"replace-id","selected":false,"cursor":false}]')).toBeInTheDocument();
37
+ fireEvent.click(screen.getByText('remove-first'));
38
+ expect(screen.getByText('[{"id":"2","item":"replace-id","selected":false,"cursor":false}]')).toBeInTheDocument();
39
+ });
40
+ it('supports move and wraparound keyboard helpers', () => {
41
+ render(_jsx(TuiListProvider, { children: _jsx(Probe, {}) }));
42
+ fireEvent.click(screen.getByText('load-two'));
43
+ fireEvent.click(screen.getByText('move-second'));
44
+ expect(screen.getByText('[{"id":"1","item":"one","selected":false,"cursor":false},{"id":"2","item":"two","selected":false,"cursor":true}]')).toBeInTheDocument();
45
+ fireEvent.click(screen.getByText('move-next'));
46
+ expect(screen.getByText('[{"id":"1","item":"one","selected":false,"cursor":true},{"id":"2","item":"two","selected":false,"cursor":false}]')).toBeInTheDocument();
47
+ fireEvent.click(screen.getByText('move-previous'));
48
+ expect(screen.getByText('[{"id":"1","item":"one","selected":false,"cursor":false},{"id":"2","item":"two","selected":false,"cursor":true}]')).toBeInTheDocument();
49
+ });
50
+ });
@@ -0,0 +1,77 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /// <reference types="vitest" />
3
+ import { fireEvent, render, screen } from '@testing-library/react';
4
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
5
+ const mockExecCommand = vi.hoisted(() => vi.fn());
6
+ const mockParse = vi.hoisted(() => vi.fn());
7
+ const mockSuggest = vi.hoisted(() => vi.fn());
8
+ vi.mock('@mui/material', async () => {
9
+ const React = await import('react');
10
+ return {
11
+ ClickAwayListener: ({ children, onClickAway }) => _jsx("div", { onClick: onClickAway, children: children }),
12
+ InputAdornment: ({ children }) => _jsx("div", { children: children }),
13
+ ListItemText: ({ children }) => _jsx("div", { children: children }),
14
+ MenuItem: ({ children, onClick }) => _jsx("button", { onClick: onClick, children: children }),
15
+ MenuList: ({ children, ref, onKeyDown }) => (_jsx("div", { ref: ref, tabIndex: 0, onKeyDown: onKeyDown, children: children })),
16
+ Paper: ({ children }) => _jsx("div", { children: children }),
17
+ Popper: ({ children, open }) => (open ? _jsx("div", { children: children }) : null),
18
+ TextField: React.forwardRef(({ value, onChange, onKeyDown, InputProps, label }, ref) => (_jsxs("div", { ref: ref, children: [_jsx("label", { children: label }), _jsx("input", { "aria-label": label ?? 'phrase', value: value, onChange: onChange, onKeyDown: onKeyDown, onSelect: InputProps?.onSelectCapture }), InputProps?.startAdornment, InputProps?.endAdornment] })))
19
+ };
20
+ });
21
+ vi.mock('@tui/core', () => ({
22
+ parseEvent: (event) => ({
23
+ isEnter: event.key === 'Enter',
24
+ isCtrl: !!event.ctrlKey,
25
+ isSpace: event.key === ' ',
26
+ isEscape: event.key === 'Escape',
27
+ isArrowDown: event.key === 'ArrowDown'
28
+ })
29
+ }));
30
+ vi.mock('./word/WordLexer', () => ({
31
+ default: class {
32
+ parse(value, cursor) {
33
+ return mockParse(value, cursor);
34
+ }
35
+ }
36
+ }));
37
+ vi.mock('./word/WordSuggester', () => ({
38
+ default: class {
39
+ constructor(_suggestions) { }
40
+ suggest(analysis) {
41
+ return mockSuggest(analysis);
42
+ }
43
+ }
44
+ }));
45
+ import Phrase from './Phrase';
46
+ describe('Phrase', () => {
47
+ beforeEach(() => {
48
+ mockParse.mockReset().mockReturnValue({
49
+ suggest: { token: { startIndex: 0, endIndex: 2 } },
50
+ tokens: ['abc']
51
+ });
52
+ mockSuggest.mockReset().mockReturnValue(['alpha']);
53
+ document.execCommand = mockExecCommand;
54
+ });
55
+ it('updates the phrase and supports ctrl-space, enter, click, and escape suggestion flows', () => {
56
+ const onChange = vi.fn();
57
+ const onKeyDown = vi.fn();
58
+ render(_jsx(Phrase, { label: "phrase", value: "abc", suggestions: ['alpha', 'beta'], onChange: onChange, onKeyDown: onKeyDown }));
59
+ const input = screen.getByLabelText('phrase');
60
+ Object.defineProperty(input, 'selectionStart', { configurable: true, value: 1 });
61
+ input.setSelectionRange = vi.fn();
62
+ input.focus = vi.fn();
63
+ fireEvent.change(input, { target: { value: 'next' } });
64
+ expect(onChange).toHaveBeenCalledWith('next');
65
+ fireEvent.keyDown(input, { key: ' ', ctrlKey: true });
66
+ expect(screen.getByText('alpha')).toBeInTheDocument();
67
+ fireEvent.keyDown(input, { key: 'Enter' });
68
+ expect(mockExecCommand).toHaveBeenCalledWith('insertText', false, 'alpha');
69
+ fireEvent.keyDown(input, { key: 'Escape' });
70
+ fireEvent.select(input);
71
+ fireEvent.keyDown(input, { key: 'ArrowDown' });
72
+ fireEvent.keyDown(input, { key: 'Tab' });
73
+ expect(onKeyDown).toHaveBeenCalled();
74
+ fireEvent.click(screen.getByText('alpha'));
75
+ expect(mockExecCommand).toHaveBeenCalledTimes(2);
76
+ });
77
+ });
@@ -0,0 +1,92 @@
1
+ /// <reference types="vitest" />
2
+ import { describe, expect, it } from 'vitest';
3
+ import PhraseConsumer from './PhraseConsumer';
4
+ import PhraseLexer from './PhraseLexer';
5
+ class WordConsumer extends PhraseConsumer {
6
+ lock(lexer) {
7
+ return /^[A-Za-z[]/.test(lexer.bufferValue());
8
+ }
9
+ consume(lexer) {
10
+ const value = this.bufferValue();
11
+ if (value.startsWith('[') && value.endsWith(']')) {
12
+ return {
13
+ type: 'group',
14
+ value,
15
+ startIndex: lexer.start(),
16
+ endIndex: lexer.end(),
17
+ children: [
18
+ {
19
+ type: 'open',
20
+ value: '[',
21
+ startIndex: lexer.start(),
22
+ endIndex: lexer.start()
23
+ },
24
+ {
25
+ type: 'value',
26
+ value: value.slice(1, -1),
27
+ startIndex: lexer.start() + 1,
28
+ endIndex: lexer.end() - 1
29
+ },
30
+ {
31
+ type: 'close',
32
+ value: ']',
33
+ startIndex: lexer.end(),
34
+ endIndex: lexer.end()
35
+ }
36
+ ]
37
+ };
38
+ }
39
+ if (lexer.aheadStartsWithAny(false, ' ') || lexer.aheadIsEmpty()) {
40
+ return { type: 'word', value, startIndex: lexer.start(), endIndex: lexer.end() };
41
+ }
42
+ return null;
43
+ }
44
+ }
45
+ class SpaceConsumer extends PhraseConsumer {
46
+ lock(lexer) {
47
+ return lexer.bufferValue() === ' ';
48
+ }
49
+ consume(lexer) {
50
+ return { type: 'space', value: ' ', startIndex: lexer.start(), endIndex: lexer.end() };
51
+ }
52
+ }
53
+ class TestLexer extends PhraseLexer {
54
+ consumers() {
55
+ return [new SpaceConsumer(), new WordConsumer()];
56
+ }
57
+ }
58
+ describe('PhraseLexer', () => {
59
+ it('parses tokens and suggestion context from the cursor', () => {
60
+ const lexer = new TestLexer();
61
+ const analysis = lexer.parse('alpha beta', 7);
62
+ expect(analysis.tokens).toEqual([
63
+ { type: 'word', value: 'alpha', startIndex: 0, endIndex: 4 },
64
+ { type: 'space', value: ' ', startIndex: 5, endIndex: 5 },
65
+ { type: 'word', value: 'beta', startIndex: 6, endIndex: 9 },
66
+ { type: 'eop', startIndex: 10, endIndex: 10, value: '' }
67
+ ]);
68
+ expect(analysis.parent.value).toBe('beta');
69
+ expect(analysis.current.value).toBe('beta');
70
+ expect(analysis.suggest.value).toBe('b');
71
+ });
72
+ it('flattens child tokens when selecting the current token', () => {
73
+ const lexer = new TestLexer();
74
+ const analysis = lexer.parse('[xy]', 1);
75
+ expect(analysis.parent.type).toBe('group');
76
+ expect(analysis.current).toMatchObject({ type: 'value', value: 'xy' });
77
+ expect(analysis.suggest.parent).toMatchObject({ type: 'group', value: '[xy]' });
78
+ });
79
+ it('exposes buffer navigation helpers while parsing', () => {
80
+ const lexer = new TestLexer();
81
+ lexer.parse('one two');
82
+ expect(lexer.start()).toBe(7);
83
+ expect(lexer.end()).toBe(6);
84
+ expect(lexer.buffer()).toEqual([]);
85
+ expect(lexer.ahead()).toBe('');
86
+ expect(lexer.aheadIsEmpty()).toBe(true);
87
+ expect(lexer.behind()).toBe('');
88
+ expect(lexer.behindEndsWithAny(false, '')).toBe(true);
89
+ expect(lexer.testAhead(/^$/)).toBe(true);
90
+ expect(lexer.testBehind(/^$/)).toBe(true);
91
+ });
92
+ });
@@ -0,0 +1,20 @@
1
+ /// <reference types="vitest" />
2
+ import { describe, expect, it } from 'vitest';
3
+ import { PhraseBuffer } from '.';
4
+ describe('PhraseBuffer', () => {
5
+ it('builds tokens from appended content', () => {
6
+ const buffer = new PhraseBuffer('word').init(3, ['a']).append('b').append('c');
7
+ expect(buffer.value()).toBe('abc');
8
+ expect(buffer.start()).toBe(3);
9
+ expect(buffer.end()).toBe(6);
10
+ expect(buffer.token()).toEqual({ type: 'word', value: 'abc', startIndex: 3, endIndex: 5 });
11
+ });
12
+ it('allows explicit start and end overrides and returns null for empty buffers', () => {
13
+ const buffer = new PhraseBuffer().init(0);
14
+ expect(buffer.token()).toBeNull();
15
+ buffer.start(5);
16
+ buffer.end(9);
17
+ expect(buffer.start()).toBe(5);
18
+ expect(buffer.end()).toBe(9);
19
+ });
20
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,107 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /// <reference types="vitest" />
3
+ import { render, screen, waitFor } from '@testing-library/react';
4
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
5
+ const mockDispatchApi = vi.hoisted(() => vi.fn());
6
+ vi.mock('@mui/icons-material', async (importOriginal) => {
7
+ const actual = await importOriginal();
8
+ return {
9
+ ...actual,
10
+ CheckCircleOutline: () => _jsx("div", { children: "complete-icon" }),
11
+ HourglassBottom: () => _jsx("div", { children: "range-icon" }),
12
+ RadioButtonUnchecked: () => _jsx("div", { children: "task-icon" }),
13
+ UpdateOutlined: () => _jsx("div", { children: "updated-icon" })
14
+ };
15
+ });
16
+ vi.mock('@mui/material', () => ({
17
+ Chip: ({ label }) => _jsx("div", { children: label }),
18
+ Divider: () => _jsx("div", { children: "divider" }),
19
+ Grid: ({ children }) => _jsx("div", { children: children }),
20
+ Skeleton: () => _jsx("div", { children: "loading" }),
21
+ Stack: ({ children }) => _jsx("div", { children: children }),
22
+ Tooltip: ({ children }) => _jsx("div", { children: children }),
23
+ Typography: ({ children }) => _jsx("div", { children: children }),
24
+ useTheme: () => ({ palette: { success: { main: 'green' } }, spacing: (n) => `${n * 8}px` })
25
+ }));
26
+ vi.mock('api', () => ({
27
+ default: {
28
+ v2: {
29
+ case: {
30
+ get: (id) => ({ id })
31
+ }
32
+ }
33
+ }
34
+ }));
35
+ vi.mock('components/elements/case/StatusIcon', () => ({
36
+ default: ({ status }) => _jsx("div", { children: `status:${status}` })
37
+ }));
38
+ vi.mock('components/elements/display/HowlerAvatar', () => ({
39
+ default: ({ userId }) => _jsx("div", { children: `avatar:${userId}` })
40
+ }));
41
+ vi.mock('components/hooks/useMyApi', () => ({
42
+ default: () => ({ dispatchApi: mockDispatchApi })
43
+ }));
44
+ vi.mock('dayjs', () => ({
45
+ default: (value) => ({ toString: () => `date:${value}` })
46
+ }));
47
+ vi.mock('react-i18next', () => ({
48
+ useTranslation: () => ({ t: (key) => key })
49
+ }));
50
+ vi.mock('utils/utils', () => ({
51
+ twitterShort: (value) => `short:${value}`
52
+ }));
53
+ vi.mock('../display/HowlerCard', () => ({
54
+ default: ({ children }) => _jsx("div", { children: children })
55
+ }));
56
+ import CaseCard from './CaseCard';
57
+ describe('CaseCard', () => {
58
+ beforeEach(() => {
59
+ mockDispatchApi.mockReset();
60
+ });
61
+ it('shows a skeleton while no case data is available', () => {
62
+ render(_jsx(CaseCard, {}));
63
+ expect(screen.getByText('loading')).toBeInTheDocument();
64
+ });
65
+ it('renders provided case details and loads by case id when needed', async () => {
66
+ mockDispatchApi.mockResolvedValueOnce({
67
+ case_id: 'case-2',
68
+ title: 'Loaded case',
69
+ status: 'resolved',
70
+ updated: '2024-01-02T00:00:00Z',
71
+ summary: 'Loaded summary',
72
+ participants: ['alice'],
73
+ targets: ['target-1'],
74
+ indicators: ['indicator-1'],
75
+ threats: ['threat-1'],
76
+ tasks: [
77
+ { id: 't1', summary: 'done task', complete: true },
78
+ { id: 't2', summary: 'todo task', complete: false }
79
+ ]
80
+ });
81
+ const { rerender } = render(_jsx(CaseCard, { case: {
82
+ case_id: 'case-1',
83
+ title: 'Case title',
84
+ status: 'resolved',
85
+ updated: '2024-01-01T00:00:00Z',
86
+ start: '2024-01-01',
87
+ end: '2024-01-02',
88
+ summary: 'First line\nSecond line',
89
+ participants: ['alice', 'bob'],
90
+ tasks: [
91
+ { id: 't1', summary: 'done task', complete: true },
92
+ { id: 't2', summary: 'todo task', complete: false }
93
+ ]
94
+ } }));
95
+ expect(screen.getByText('Case title')).toBeInTheDocument();
96
+ expect(screen.getByText('status:resolved')).toBeInTheDocument();
97
+ expect(screen.getByText('short:2024-01-01 - short:2024-01-02')).toBeInTheDocument();
98
+ expect(screen.getByText('short:2024-01-01T00:00:00Z')).toBeInTheDocument();
99
+ expect(screen.getByText('First line')).toBeInTheDocument();
100
+ expect(screen.getByText('avatar:alice')).toBeInTheDocument();
101
+ expect(screen.getByText('1 complete')).toBeInTheDocument();
102
+ expect(screen.getByText('todo task')).toBeInTheDocument();
103
+ rerender(_jsx(CaseCard, { caseId: "case-2" }));
104
+ await waitFor(() => expect(mockDispatchApi).toHaveBeenCalledWith({ id: 'case-2' }, { throwError: false }));
105
+ await waitFor(() => expect(screen.getByText('Loaded case')).toBeInTheDocument());
106
+ });
107
+ });
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /// <reference types="vitest" />
3
+ import { render, screen } from '@testing-library/react';
4
+ import { describe, expect, it, vi } from 'vitest';
5
+ const apiConfigContextToken = vi.hoisted(() => ({ name: 'api-config-context' }));
6
+ let configValue = {
7
+ config: {
8
+ c12nDef: {
9
+ levels_map: { 0: 'secret' },
10
+ levels_styles_map: { secret: { color: 'primary' } }
11
+ }
12
+ }
13
+ };
14
+ const mockGetParts = vi.hoisted(() => vi.fn(() => ({ lvlIdx: 0 })));
15
+ const mockNormalized = vi.hoisted(() => vi.fn(() => 'S'));
16
+ vi.mock('@mui/material', () => ({
17
+ Chip: ({ label, color, sx, variant }) => (_jsx("div", { "data-color": color, "data-variant": variant, "data-sx": JSON.stringify(sx), children: label })),
18
+ Tooltip: ({ children }) => _jsx("div", { children: children })
19
+ }));
20
+ vi.mock('components/app/providers/ApiConfigProvider', () => ({
21
+ ApiConfigContext: apiConfigContextToken
22
+ }));
23
+ vi.mock('utils/classificationParser', () => ({
24
+ getParts: mockGetParts,
25
+ normalizedClassification: mockNormalized
26
+ }));
27
+ vi.mock('react', async (importOriginal) => {
28
+ const actual = await importOriginal();
29
+ return {
30
+ ...actual,
31
+ useContext: (context) => {
32
+ if (context === apiConfigContextToken)
33
+ return configValue;
34
+ return actual.useContext(context);
35
+ }
36
+ };
37
+ });
38
+ import ClassificationChip from './ClassificationChip';
39
+ describe('ClassificationChip', () => {
40
+ it('renders normalized values with theme colors', () => {
41
+ render(_jsx(ClassificationChip, { classification: "SECRET" }));
42
+ expect(screen.getByText('S')).toHaveAttribute('data-color', 'primary');
43
+ });
44
+ it('falls back to sx colors or the original classification', () => {
45
+ configValue = {
46
+ config: {
47
+ c12nDef: {
48
+ levels_map: { 0: 'secret' },
49
+ levels_styles_map: { secret: { color: '#ff0000' } }
50
+ }
51
+ }
52
+ };
53
+ const { rerender } = render(_jsx(ClassificationChip, { classification: "SECRET", variant: "filled", sx: { m: 1 } }));
54
+ expect(screen.getByText('S')).toHaveAttribute('data-variant', 'filled');
55
+ expect(screen.getByText('S').getAttribute('data-sx')).toContain('#ff0000');
56
+ configValue = { config: { c12nDef: undefined } };
57
+ rerender(_jsx(ClassificationChip, { classification: "RAW" }));
58
+ expect(screen.getByText('RAW')).toHaveAttribute('data-color', 'default');
59
+ });
60
+ });