@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.
- package/api/action/execute.test.d.ts +1 -0
- package/api/action/execute.test.js +38 -0
- package/api/action/index.test.d.ts +1 -0
- package/api/action/index.test.js +59 -0
- package/api/action/operations.test.d.ts +1 -0
- package/api/action/operations.test.js +23 -0
- package/api/analytic/comments/index.test.d.ts +1 -0
- package/api/analytic/comments/index.test.js +43 -0
- package/api/analytic/comments/react.test.d.ts +1 -0
- package/api/analytic/comments/react.test.js +27 -0
- package/api/analytic/favourite.test.d.ts +1 -0
- package/api/analytic/favourite.test.js +20 -0
- package/api/analytic/index.test.d.ts +1 -0
- package/api/analytic/index.test.js +54 -0
- package/api/analytic/notebooks/index.test.d.ts +1 -0
- package/api/analytic/notebooks/index.test.js +31 -0
- package/api/analytic/owner.test.d.ts +1 -0
- package/api/analytic/owner.test.js +25 -0
- package/api/auth/apikey.test.d.ts +1 -0
- package/api/auth/apikey.test.js +34 -0
- package/api/auth/index.test.d.ts +1 -0
- package/api/auth/index.test.js +21 -0
- package/api/auth/login.test.d.ts +1 -0
- package/api/auth/login.test.js +53 -0
- package/api/configs/index.test.d.ts +1 -0
- package/api/configs/index.test.js +22 -0
- package/api/dossier/index.test.d.ts +1 -0
- package/api/dossier/index.test.js +57 -0
- package/api/help.test.d.ts +1 -0
- package/api/help.test.js +25 -0
- package/api/hit/assign.test.d.ts +1 -0
- package/api/hit/assign.test.js +22 -0
- package/api/hit/comments/index.test.d.ts +1 -0
- package/api/hit/comments/index.test.js +47 -0
- package/api/hit/comments/react.test.d.ts +1 -0
- package/api/hit/comments/react.test.js +27 -0
- package/api/hit/index.test.d.ts +1 -0
- package/api/hit/index.test.js +49 -0
- package/api/hit/labels.test.d.ts +1 -0
- package/api/hit/labels.test.js +29 -0
- package/api/hit/overwrite.test.d.ts +1 -0
- package/api/hit/overwrite.test.js +23 -0
- package/api/hit/transition.test.d.ts +1 -0
- package/api/hit/transition.test.js +24 -0
- package/api/index.test.d.ts +1 -0
- package/api/index.test.js +137 -0
- package/api/notebook/environments.test.d.ts +1 -0
- package/api/notebook/environments.test.js +22 -0
- package/api/notebook/index.test.d.ts +1 -0
- package/api/notebook/index.test.js +28 -0
- package/api/overview/index.test.d.ts +1 -0
- package/api/overview/index.test.js +42 -0
- package/api/search/fields/index.test.d.ts +1 -0
- package/api/search/fields/index.test.js +31 -0
- package/api/search/grouped/index.test.d.ts +1 -0
- package/api/search/grouped/index.test.js +18 -0
- package/api/search/grouped/user.test.d.ts +1 -0
- package/api/search/grouped/user.test.js +33 -0
- package/api/search/index.test.d.ts +1 -0
- package/api/search/index.test.js +41 -0
- package/api/search/user.test.d.ts +1 -0
- package/api/search/user.test.js +41 -0
- package/api/socket/index.test.d.ts +1 -0
- package/api/socket/index.test.js +15 -0
- package/api/template/index.test.d.ts +1 -0
- package/api/template/index.test.js +43 -0
- package/api/user/avatar/index.test.d.ts +1 -0
- package/api/user/avatar/index.test.js +22 -0
- package/api/user/groups.test.d.ts +1 -0
- package/api/user/groups.test.js +22 -0
- package/api/user/index.test.d.ts +1 -0
- package/api/user/index.test.js +37 -0
- package/api/user/whoami.test.d.ts +1 -0
- package/api/user/whoami.test.js +26 -0
- package/api/utils/createPermissionsApi.test.d.ts +1 -0
- package/api/utils/createPermissionsApi.test.js +30 -0
- package/api/v2/case/index.test.d.ts +1 -0
- package/api/v2/case/index.test.js +57 -0
- package/api/v2/case/items.test.d.ts +1 -0
- package/api/v2/case/items.test.js +37 -0
- package/api/v2/case/rules.test.d.ts +1 -0
- package/api/v2/case/rules.test.js +33 -0
- package/api/v2/fuzzy.test.d.ts +1 -0
- package/api/v2/fuzzy.test.js +30 -0
- package/api/v2/index.test.d.ts +1 -0
- package/api/v2/index.test.js +13 -0
- package/api/v2/search/index.test.d.ts +1 -0
- package/api/v2/search/index.test.js +42 -0
- package/api/view/index.test.d.ts +1 -0
- package/api/view/index.test.js +54 -0
- package/branding/AppBrand.test.d.ts +1 -0
- package/branding/AppBrand.test.js +29 -0
- package/components/app/drawers/ApiKeyDrawer.test.d.ts +1 -0
- package/components/app/drawers/ApiKeyDrawer.test.js +119 -0
- package/components/app/drawers/AssignUserDrawer.test.d.ts +1 -0
- package/components/app/drawers/AssignUserDrawer.test.js +75 -0
- package/components/app/hooks/useTitle.test.d.ts +1 -0
- package/components/app/hooks/useTitle.test.js +103 -0
- package/components/app/providers/AnalyticProvider.test.d.ts +1 -0
- package/components/app/providers/AnalyticProvider.test.js +58 -0
- package/components/app/providers/AppBarProvider.test.d.ts +1 -0
- package/components/app/providers/AppBarProvider.test.js +23 -0
- package/components/app/providers/AppDrawerProvider.test.d.ts +1 -0
- package/components/app/providers/AppDrawerProvider.test.js +42 -0
- package/components/app/providers/AvatarProvider.test.d.ts +1 -0
- package/components/app/providers/AvatarProvider.test.js +50 -0
- package/components/app/providers/CustomPluginProvider.test.d.ts +1 -0
- package/components/app/providers/CustomPluginProvider.test.js +29 -0
- package/components/app/providers/FavouritesProvider.test.d.ts +1 -0
- package/components/app/providers/FavouritesProvider.test.js +115 -0
- package/components/app/providers/FieldProvider.test.d.ts +1 -0
- package/components/app/providers/FieldProvider.test.js +28 -0
- package/components/app/providers/LocalStorageProvider.test.d.ts +1 -0
- package/components/app/providers/LocalStorageProvider.test.js +42 -0
- package/components/app/providers/ModalProvider.test.d.ts +1 -0
- package/components/app/providers/ModalProvider.test.js +35 -0
- package/components/app/providers/OverviewProvider.test.d.ts +1 -0
- package/components/app/providers/OverviewProvider.test.js +62 -0
- package/components/app/providers/RecordProvider.test.d.ts +1 -0
- package/components/app/providers/RecordProvider.test.js +66 -0
- package/components/app/providers/contextUtils.test.d.ts +1 -0
- package/components/app/providers/contextUtils.test.js +8 -0
- package/components/elements/Comment.test.d.ts +1 -0
- package/components/elements/Comment.test.js +109 -0
- package/components/elements/EditRow.test.d.ts +1 -0
- package/components/elements/EditRow.test.js +88 -0
- package/components/elements/MarkdownEditor.test.d.ts +1 -0
- package/components/elements/MarkdownEditor.test.js +75 -0
- package/components/elements/ObjectDetails.test.d.ts +1 -0
- package/components/elements/ObjectDetails.test.js +70 -0
- package/components/elements/PluginChip.d.ts +3 -2
- package/components/elements/PluginChip.js +2 -2
- package/components/elements/PluginChip.test.d.ts +1 -0
- package/components/elements/PluginChip.test.js +30 -0
- package/components/elements/ThemedEditor.test.d.ts +1 -0
- package/components/elements/ThemedEditor.test.js +66 -0
- package/components/elements/addons/layout/FlexPort.test.d.ts +1 -0
- package/components/elements/addons/layout/FlexPort.test.js +34 -0
- package/components/elements/addons/lists/TuiListBase.test.d.ts +1 -0
- package/components/elements/addons/lists/TuiListBase.test.js +44 -0
- package/components/elements/addons/lists/TuiListProvider.test.d.ts +1 -0
- package/components/elements/addons/lists/TuiListProvider.test.js +50 -0
- package/components/elements/addons/search/phrase/Phrase.test.d.ts +1 -0
- package/components/elements/addons/search/phrase/Phrase.test.js +77 -0
- package/components/elements/addons/search/phrase/PhraseLexer.test.d.ts +1 -0
- package/components/elements/addons/search/phrase/PhraseLexer.test.js +92 -0
- package/components/elements/addons/search/phrase/index.test.d.ts +1 -0
- package/components/elements/addons/search/phrase/index.test.js +20 -0
- package/components/elements/case/CaseCard.test.d.ts +1 -0
- package/components/elements/case/CaseCard.test.js +107 -0
- package/components/elements/display/ClassificationChip.test.d.ts +1 -0
- package/components/elements/display/ClassificationChip.test.js +60 -0
- package/components/elements/display/HandlebarsMarkdown.test.d.ts +1 -0
- package/components/elements/display/HandlebarsMarkdown.test.js +41 -0
- package/components/elements/display/HowlerAvatar.test.d.ts +1 -0
- package/components/elements/display/HowlerAvatar.test.js +54 -0
- package/components/elements/display/ItemManager.test.d.ts +1 -0
- package/components/elements/display/ItemManager.test.js +68 -0
- package/components/elements/display/UserPageWrapper.test.d.ts +1 -0
- package/components/elements/display/UserPageWrapper.test.js +22 -0
- package/components/elements/display/handlebars/helpers.test.d.ts +1 -0
- package/components/elements/display/handlebars/helpers.test.js +104 -0
- package/components/elements/display/icons/SocketBadge.test.d.ts +1 -0
- package/components/elements/display/icons/SocketBadge.test.js +49 -0
- package/components/elements/display/markdownPlugins/tabs.test.d.ts +1 -0
- package/components/elements/display/markdownPlugins/tabs.test.js +50 -0
- package/components/elements/hit/HitActions.js +1 -1
- package/components/elements/hit/HitActions.test.d.ts +1 -0
- package/components/elements/hit/HitActions.test.js +166 -0
- package/components/elements/hit/HitLabels.test.js +34 -3
- package/components/elements/hit/HitNotebooks.test.d.ts +1 -0
- package/components/elements/hit/HitNotebooks.test.js +138 -0
- package/components/elements/hit/HitSummary.test.d.ts +1 -0
- package/components/elements/hit/HitSummary.test.js +188 -0
- package/components/elements/hit/actions/ButtonActions.test.d.ts +1 -0
- package/components/elements/hit/actions/ButtonActions.test.js +51 -0
- package/components/elements/hit/actions/DropdownActions.test.d.ts +1 -0
- package/components/elements/hit/actions/DropdownActions.test.js +60 -0
- package/components/elements/hit/grid/AddColumnModal.test.d.ts +1 -0
- package/components/elements/hit/grid/AddColumnModal.test.js +88 -0
- package/components/elements/hit/grid/RecordTable.test.d.ts +1 -0
- package/components/elements/hit/grid/RecordTable.test.js +99 -0
- package/components/elements/record/RecordComments.test.d.ts +1 -0
- package/components/elements/record/RecordComments.test.js +151 -0
- package/components/elements/record/RecordContextMenu.js +3 -3
- package/components/elements/record/RecordRelated.test.d.ts +1 -0
- package/components/elements/record/RecordRelated.test.js +77 -0
- package/components/elements/record/RecordWorklog.test.d.ts +1 -0
- package/components/elements/record/RecordWorklog.test.js +77 -0
- package/components/hooks/useHitActions.test.d.ts +1 -0
- package/components/hooks/useHitActions.test.js +189 -0
- package/components/hooks/useMyApi.test.d.ts +1 -0
- package/components/hooks/useMyApi.test.js +31 -0
- package/components/hooks/useMyChart.test.d.ts +1 -0
- package/components/hooks/useMyChart.test.js +62 -0
- package/components/hooks/useMySearch.test.d.ts +1 -0
- package/components/hooks/useMySearch.test.js +96 -0
- package/components/hooks/useMySnackbar.test.d.ts +1 -0
- package/components/hooks/useMySnackbar.test.js +36 -0
- package/components/hooks/useMyUserFunctions.test.d.ts +1 -0
- package/components/hooks/useMyUserFunctions.test.js +142 -0
- package/components/hooks/useRecordSelection.test.d.ts +1 -0
- package/components/hooks/useRecordSelection.test.js +102 -0
- package/components/logins/Login.test.d.ts +1 -0
- package/components/logins/Login.test.js +67 -0
- package/components/logins/hooks/useLogin.test.d.ts +1 -0
- package/components/logins/hooks/useLogin.test.js +142 -0
- package/components/routes/action/shared/OperationEntry.test.d.ts +1 -0
- package/components/routes/action/shared/OperationEntry.test.js +80 -0
- package/components/routes/action/shared/OperationStep.test.d.ts +1 -0
- package/components/routes/action/shared/OperationStep.test.js +84 -0
- package/components/routes/action/useMyActionFunctions.test.d.ts +1 -0
- package/components/routes/action/useMyActionFunctions.test.js +217 -0
- package/components/routes/action/view/ActionDetails.test.d.ts +1 -0
- package/components/routes/action/view/ActionDetails.test.js +170 -0
- package/components/routes/action/view/ActionSearch.test.d.ts +1 -0
- package/components/routes/action/view/ActionSearch.test.js +185 -0
- package/components/routes/action/view/Integrations.test.d.ts +1 -0
- package/components/routes/action/view/Integrations.test.js +62 -0
- package/components/routes/admin/users/UserEditor.test.d.ts +1 -0
- package/components/routes/admin/users/UserEditor.test.js +74 -0
- package/components/routes/admin/users/UserSearch.test.d.ts +1 -0
- package/components/routes/admin/users/UserSearch.test.js +146 -0
- package/components/routes/advanced/QueryBuilder.test.d.ts +1 -0
- package/components/routes/advanced/QueryBuilder.test.js +185 -0
- package/components/routes/advanced/QueryEditor.test.d.ts +1 -0
- package/components/routes/advanced/QueryEditor.test.js +130 -0
- package/components/routes/advanced/completionProviders.test.d.ts +1 -0
- package/components/routes/advanced/completionProviders.test.js +144 -0
- package/components/routes/analytics/AnalyticComments.test.d.ts +1 -0
- package/components/routes/analytics/AnalyticComments.test.js +156 -0
- package/components/routes/analytics/AnalyticDetails.test.d.ts +1 -0
- package/components/routes/analytics/AnalyticDetails.test.js +161 -0
- package/components/routes/analytics/AnalyticNotebooks.test.d.ts +1 -0
- package/components/routes/analytics/AnalyticNotebooks.test.js +112 -0
- package/components/routes/analytics/AnalyticOverview.test.d.ts +1 -0
- package/components/routes/analytics/AnalyticOverview.test.js +97 -0
- package/components/routes/analytics/AnalyticOverviews.test.d.ts +1 -0
- package/components/routes/analytics/AnalyticOverviews.test.js +70 -0
- package/components/routes/analytics/AnalyticSearch.test.d.ts +1 -0
- package/components/routes/analytics/AnalyticSearch.test.js +167 -0
- package/components/routes/analytics/AnalyticTemplates.test.d.ts +1 -0
- package/components/routes/analytics/AnalyticTemplates.test.js +63 -0
- package/components/routes/analytics/TriageSettings.test.d.ts +1 -0
- package/components/routes/analytics/TriageSettings.test.js +89 -0
- package/components/routes/analytics/widgets/Assessment.test.d.ts +1 -0
- package/components/routes/analytics/widgets/Assessment.test.js +45 -0
- package/components/routes/analytics/widgets/Created.test.d.ts +1 -0
- package/components/routes/analytics/widgets/Created.test.js +41 -0
- package/components/routes/analytics/widgets/DetectionStatus.test.d.ts +1 -0
- package/components/routes/analytics/widgets/DetectionStatus.test.js +21 -0
- package/components/routes/analytics/widgets/Stacked.test.d.ts +1 -0
- package/components/routes/analytics/widgets/Stacked.test.js +51 -0
- package/components/routes/cases/Cases.test.d.ts +1 -0
- package/components/routes/cases/Cases.test.js +132 -0
- package/components/routes/dossiers/Dossiers.test.d.ts +1 -0
- package/components/routes/dossiers/Dossiers.test.js +150 -0
- package/components/routes/help/ActionDocumentation.test.d.ts +1 -0
- package/components/routes/help/ActionDocumentation.test.js +58 -0
- package/components/routes/help/ActionIntroductionDocumentation.test.d.ts +1 -0
- package/components/routes/help/ActionIntroductionDocumentation.test.js +68 -0
- package/components/routes/help/ApiDocumentation.test.d.ts +1 -0
- package/components/routes/help/ApiDocumentation.test.js +79 -0
- package/components/routes/help/AuthDocumentation.test.d.ts +1 -0
- package/components/routes/help/AuthDocumentation.test.js +34 -0
- package/components/routes/help/ClientDocumentation.test.d.ts +1 -0
- package/components/routes/help/ClientDocumentation.test.js +34 -0
- package/components/routes/help/Help.test.d.ts +1 -0
- package/components/routes/help/Help.test.js +57 -0
- package/components/routes/help/HitBannerDocumentation.test.d.ts +1 -0
- package/components/routes/help/HitBannerDocumentation.test.js +25 -0
- package/components/routes/help/HitDocumentation.test.d.ts +1 -0
- package/components/routes/help/HitDocumentation.test.js +53 -0
- package/components/routes/help/HitLabelsDocumentation.test.d.ts +1 -0
- package/components/routes/help/HitLabelsDocumentation.test.js +17 -0
- package/components/routes/help/HitLinksDocumentation.test.d.ts +1 -0
- package/components/routes/help/HitLinksDocumentation.test.js +27 -0
- package/components/routes/help/HitSchemaDocumentation.test.d.ts +1 -0
- package/components/routes/help/HitSchemaDocumentation.test.js +67 -0
- package/components/routes/help/NotebookDocumentation.test.d.ts +1 -0
- package/components/routes/help/NotebookDocumentation.test.js +34 -0
- package/components/routes/help/OverviewDocumentation.test.d.ts +1 -0
- package/components/routes/help/OverviewDocumentation.test.js +26 -0
- package/components/routes/help/RetentionDocumentation.test.d.ts +1 -0
- package/components/routes/help/RetentionDocumentation.test.js +61 -0
- package/components/routes/help/SearchDocumentation.test.d.ts +1 -0
- package/components/routes/help/SearchDocumentation.test.js +65 -0
- package/components/routes/help/TemplateDocumentation.test.d.ts +1 -0
- package/components/routes/help/TemplateDocumentation.test.js +58 -0
- package/components/routes/help/ViewDocumentation.test.d.ts +1 -0
- package/components/routes/help/ViewDocumentation.test.js +34 -0
- package/components/routes/help/components/HelpTabs.test.d.ts +1 -0
- package/components/routes/help/components/HelpTabs.test.js +26 -0
- package/components/routes/hits/search/InformationPane.test.d.ts +1 -0
- package/components/routes/hits/search/InformationPane.test.js +251 -0
- package/components/routes/hits/search/RecordBrowser.test.js +179 -51
- package/components/routes/hits/search/RecordQuery.test.d.ts +1 -0
- package/components/routes/hits/search/RecordQuery.test.js +117 -0
- package/components/routes/hits/search/SearchPane.test.d.ts +1 -0
- package/components/routes/hits/search/SearchPane.test.js +178 -0
- package/components/routes/hits/search/grid/RecordGrid.test.d.ts +1 -0
- package/components/routes/hits/search/grid/RecordGrid.test.js +107 -0
- package/components/routes/hits/search/shared/CustomSort.test.d.ts +1 -0
- package/components/routes/hits/search/shared/CustomSort.test.js +77 -0
- package/components/routes/hits/search/shared/HitFilter.test.d.ts +1 -0
- package/components/routes/hits/search/shared/HitFilter.test.js +83 -0
- package/components/routes/hits/search/shared/HitSort.test.d.ts +1 -0
- package/components/routes/hits/search/shared/HitSort.test.js +61 -0
- package/components/routes/hits/search/shared/LayoutSettings.test.d.ts +1 -0
- package/components/routes/hits/search/shared/LayoutSettings.test.js +84 -0
- package/components/routes/hits/search/shared/SearchSpan.test.d.ts +1 -0
- package/components/routes/hits/search/shared/SearchSpan.test.js +84 -0
- package/components/routes/home/AnalyticCard.test.d.ts +1 -0
- package/components/routes/home/AnalyticCard.test.js +87 -0
- package/components/routes/home/index.test.d.ts +1 -0
- package/components/routes/home/index.test.js +190 -0
- package/components/routes/overviews/OverviewViewer.test.d.ts +1 -0
- package/components/routes/overviews/OverviewViewer.test.js +151 -0
- package/components/routes/overviews/Overviews.test.d.ts +1 -0
- package/components/routes/overviews/Overviews.test.js +154 -0
- package/components/routes/settings/AdminSection.test.d.ts +1 -0
- package/components/routes/settings/AdminSection.test.js +26 -0
- package/components/routes/settings/LocalSection.test.d.ts +1 -0
- package/components/routes/settings/LocalSection.test.js +75 -0
- package/components/routes/settings/ProfileSection.test.d.ts +1 -0
- package/components/routes/settings/ProfileSection.test.js +95 -0
- package/components/routes/settings/SecuritySection.test.d.ts +1 -0
- package/components/routes/settings/SecuritySection.test.js +90 -0
- package/components/routes/settings/Settings.test.d.ts +1 -0
- package/components/routes/settings/Settings.test.js +60 -0
- package/components/routes/templates/TemplateEditor.test.d.ts +1 -0
- package/components/routes/templates/TemplateEditor.test.js +94 -0
- package/components/routes/templates/TemplateViewer.test.d.ts +1 -0
- package/components/routes/templates/TemplateViewer.test.js +145 -0
- package/components/routes/templates/Templates.test.d.ts +1 -0
- package/components/routes/templates/Templates.test.js +165 -0
- package/components/routes/views/ViewComposer.test.d.ts +1 -0
- package/components/routes/views/ViewComposer.test.js +320 -0
- package/components/routes/views/Views.test.d.ts +1 -0
- package/components/routes/views/Views.test.js +247 -0
- package/package.json +1 -1
- package/plugins/HowlerPlugin.test.d.ts +1 -0
- package/plugins/HowlerPlugin.test.js +103 -0
- package/plugins/clue/components/ClueChip.js +2 -2
- package/plugins/clue/helpers.test.d.ts +1 -0
- package/plugins/clue/helpers.test.js +100 -0
- package/plugins/store.test.d.ts +1 -0
- package/plugins/store.test.js +53 -0
- package/utils/classificationParser.test.d.ts +1 -0
- package/utils/classificationParser.test.js +199 -0
- package/utils/constants.test.d.ts +1 -0
- package/utils/constants.test.js +62 -0
- package/utils/typeUtils.test.d.ts +1 -0
- package/utils/typeUtils.test.js +22 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/// <reference types="vitest" />
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
6
|
+
const mockUseMediaQuery = vi.hoisted(() => vi.fn(() => false));
|
|
7
|
+
const mockSetSearchParams = vi.hoisted(() => vi.fn());
|
|
8
|
+
const searchParams = new URLSearchParams({ tab: 'plugin-doc' });
|
|
9
|
+
const mockExecuteFunction = vi.hoisted(() => vi.fn(() => ({
|
|
10
|
+
id: 'plugin-doc',
|
|
11
|
+
i18nKey: 'plugin.doc',
|
|
12
|
+
component: () => _jsx("div", { children: "plugin documentation" })
|
|
13
|
+
})));
|
|
14
|
+
vi.mock('@mui/material', async (importOriginal) => {
|
|
15
|
+
const actual = await importOriginal();
|
|
16
|
+
return {
|
|
17
|
+
...actual,
|
|
18
|
+
useMediaQuery: mockUseMediaQuery
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
vi.mock('@tui/core', () => ({
|
|
22
|
+
PageCenter: ({ children }) => _jsx("div", { children: children })
|
|
23
|
+
}));
|
|
24
|
+
vi.mock('components/hooks/useScrollRestoration', () => ({
|
|
25
|
+
useScrollRestoration: vi.fn()
|
|
26
|
+
}));
|
|
27
|
+
vi.mock('plugins/store', () => ({
|
|
28
|
+
default: {
|
|
29
|
+
operations: ['triage']
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
vi.mock('react-i18next', () => ({
|
|
33
|
+
useTranslation: () => ({ t: (key) => key })
|
|
34
|
+
}));
|
|
35
|
+
vi.mock('react-pluggable', () => ({
|
|
36
|
+
usePluginStore: () => ({ executeFunction: mockExecuteFunction })
|
|
37
|
+
}));
|
|
38
|
+
vi.mock('react-router', () => ({
|
|
39
|
+
useSearchParams: () => [searchParams, mockSetSearchParams]
|
|
40
|
+
}));
|
|
41
|
+
vi.mock('./ActionIntroductionDocumentation', () => ({
|
|
42
|
+
default: () => _jsx("div", { children: "intro documentation" })
|
|
43
|
+
}));
|
|
44
|
+
vi.mock('./components/HelpTabs', () => ({
|
|
45
|
+
default: ({ children }) => _jsx("div", { children: children })
|
|
46
|
+
}));
|
|
47
|
+
import ActionDocumentation from './ActionDocumentation';
|
|
48
|
+
describe('ActionDocumentation', () => {
|
|
49
|
+
it('renders plugin documentation from the selected tab and updates search params on tab change', async () => {
|
|
50
|
+
const user = userEvent.setup();
|
|
51
|
+
render(_jsx(ActionDocumentation, {}));
|
|
52
|
+
expect(screen.getByText('plugin documentation')).toBeInTheDocument();
|
|
53
|
+
await user.click(screen.getByRole('tab', { name: 'help.actions.introduction' }));
|
|
54
|
+
expect(screen.getByText('intro documentation')).toBeInTheDocument();
|
|
55
|
+
expect(mockSetSearchParams).toHaveBeenCalled();
|
|
56
|
+
expect(mockExecuteFunction).toHaveBeenCalledWith('operation.triage.documentation');
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/// <reference types="vitest" />
|
|
3
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
4
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
+
const mockOperationsGet = vi.hoisted(() => vi.fn());
|
|
6
|
+
vi.mock('@tui/core', () => ({
|
|
7
|
+
useAppUser: () => ({ user: { roles: ['analyst'] } })
|
|
8
|
+
}));
|
|
9
|
+
vi.mock('api', () => ({
|
|
10
|
+
default: {
|
|
11
|
+
action: {
|
|
12
|
+
operations: {
|
|
13
|
+
get: mockOperationsGet
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
vi.mock('components/elements/addons/search/phrase/Phrase', () => ({
|
|
19
|
+
default: () => _jsx("div", { children: "phrase" })
|
|
20
|
+
}));
|
|
21
|
+
vi.mock('components/elements/display/Markdown', () => ({
|
|
22
|
+
default: ({ components }) => (_jsxs("div", { children: [_jsx("div", { children: components.action_count }), _jsx("div", { children: components.action_list }), _jsx("div", { children: components.tui_phrase }), _jsx("div", { children: components.operation_select }), _jsx("div", { children: components.operation_configuration }), _jsx("div", { children: components.report }), _jsx("div", { children: components.automation_options })] }))
|
|
23
|
+
}));
|
|
24
|
+
vi.mock('../../elements/display/QueryResultText', () => ({
|
|
25
|
+
default: ({ count, query }) => (_jsxs("div", { children: [count, ":", query] }))
|
|
26
|
+
}));
|
|
27
|
+
vi.mock('../action/shared/ActionReportDisplay', () => ({
|
|
28
|
+
default: ({ operations }) => _jsxs("div", { children: ["report:", operations.length] })
|
|
29
|
+
}));
|
|
30
|
+
vi.mock('../action/shared/OperationStep', () => ({
|
|
31
|
+
default: ({ step }) => _jsxs("div", { children: ["step:", Object.keys(step.args).join(',')] })
|
|
32
|
+
}));
|
|
33
|
+
vi.mock('react-i18next', () => ({
|
|
34
|
+
useTranslation: () => ({
|
|
35
|
+
i18n: { language: 'en' },
|
|
36
|
+
t: (key) => key
|
|
37
|
+
})
|
|
38
|
+
}));
|
|
39
|
+
import ActionIntroductionDocumentation from './ActionIntroductionDocumentation';
|
|
40
|
+
describe('ActionIntroductionDocumentation', () => {
|
|
41
|
+
it('loads permitted operations and renders the markdown component slots', async () => {
|
|
42
|
+
mockOperationsGet.mockResolvedValue([
|
|
43
|
+
{
|
|
44
|
+
id: 'add_label',
|
|
45
|
+
title: 'Add Label',
|
|
46
|
+
description: { short: 'Short desc' },
|
|
47
|
+
roles: ['analyst'],
|
|
48
|
+
steps: [{ args: { category: true } }]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 'blocked',
|
|
52
|
+
title: 'Blocked',
|
|
53
|
+
description: { short: 'Blocked desc' },
|
|
54
|
+
roles: ['admin'],
|
|
55
|
+
steps: []
|
|
56
|
+
}
|
|
57
|
+
]);
|
|
58
|
+
render(_jsx(ActionIntroductionDocumentation, {}));
|
|
59
|
+
await waitFor(() => expect(screen.getByText('1')).toBeInTheDocument());
|
|
60
|
+
expect(screen.getByText(/operations.add_label/)).toBeInTheDocument();
|
|
61
|
+
expect(screen.queryByText(/blocked/i)).toBeNull();
|
|
62
|
+
expect(screen.getByText('phrase')).toBeInTheDocument();
|
|
63
|
+
expect(screen.getByText('134:howler.id:*')).toBeInTheDocument();
|
|
64
|
+
expect(screen.getByText('step:category')).toBeInTheDocument();
|
|
65
|
+
expect(screen.getByText('report:1')).toBeInTheDocument();
|
|
66
|
+
expect(screen.getByText('route.actions.trigger.create, route.actions.trigger.promote, route.actions.trigger.demote')).toBeInTheDocument();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/// <reference types="vitest" />
|
|
3
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
4
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
+
const mockUseMediaQuery = vi.hoisted(() => vi.fn(() => false));
|
|
6
|
+
const mockDispatchApi = vi.hoisted(() => vi.fn((promise) => Promise.resolve(promise)));
|
|
7
|
+
const mockHelpGet = vi.hoisted(() => vi.fn());
|
|
8
|
+
vi.mock('@mui/material', async (importOriginal) => {
|
|
9
|
+
const actual = await importOriginal();
|
|
10
|
+
return {
|
|
11
|
+
...actual,
|
|
12
|
+
useMediaQuery: mockUseMediaQuery
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
vi.mock('@tui/core', () => ({
|
|
16
|
+
PageCenter: ({ children }) => _jsx("div", { children: children }),
|
|
17
|
+
useAppUser: () => ({ user: { roles: ['admin'] } })
|
|
18
|
+
}));
|
|
19
|
+
vi.mock('api', () => ({
|
|
20
|
+
default: {
|
|
21
|
+
help: {
|
|
22
|
+
get: mockHelpGet
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
vi.mock('components/hooks/useMyApi', () => ({
|
|
27
|
+
default: () => ({ dispatchApi: mockDispatchApi })
|
|
28
|
+
}));
|
|
29
|
+
vi.mock('components/hooks/useScrollRestoration', () => ({
|
|
30
|
+
useScrollRestoration: vi.fn()
|
|
31
|
+
}));
|
|
32
|
+
vi.mock('components/elements/display/Markdown', () => ({
|
|
33
|
+
default: ({ md }) => _jsx("div", { children: md })
|
|
34
|
+
}));
|
|
35
|
+
vi.mock('react-i18next', () => ({
|
|
36
|
+
Trans: ({ i18nKey }) => _jsx("span", { children: i18nKey }),
|
|
37
|
+
useTranslation: () => ({ t: (key) => key })
|
|
38
|
+
}));
|
|
39
|
+
import ApiDocumentation from './ApiDocumentation';
|
|
40
|
+
describe('ApiDocumentation', () => {
|
|
41
|
+
it('shows a loading state until API documentation arrives', () => {
|
|
42
|
+
mockHelpGet.mockReturnValue({ apis: [], blueprints: {} });
|
|
43
|
+
mockDispatchApi.mockImplementation(() => new Promise(() => { }));
|
|
44
|
+
render(_jsx(ApiDocumentation, {}));
|
|
45
|
+
expect(screen.getByText('loading')).toBeInTheDocument();
|
|
46
|
+
});
|
|
47
|
+
it('renders categories and endpoint details once the API documentation is loaded', async () => {
|
|
48
|
+
mockHelpGet.mockReturnValue({
|
|
49
|
+
blueprints: { admin: 'Admin APIs' },
|
|
50
|
+
apis: [
|
|
51
|
+
{
|
|
52
|
+
id: '1',
|
|
53
|
+
name: 'Users',
|
|
54
|
+
path: '/api/v1/user',
|
|
55
|
+
complete: true,
|
|
56
|
+
protected: true,
|
|
57
|
+
methods: ['GET', 'POST'],
|
|
58
|
+
ui_only: true,
|
|
59
|
+
required_type: ['admin'],
|
|
60
|
+
required_priv: ['R', 'W'],
|
|
61
|
+
description: 'Data Block:\nvalue\nResult Example:\nresult'
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
mockDispatchApi.mockImplementation((promise) => Promise.resolve(promise));
|
|
66
|
+
render(_jsx(ApiDocumentation, {}));
|
|
67
|
+
await waitFor(() => expect(screen.getByText('page.documentation.categories')).toBeInTheDocument());
|
|
68
|
+
expect(screen.getAllByText('admin').length).toBeGreaterThan(0);
|
|
69
|
+
expect(screen.getByText('Admin APIs')).toBeInTheDocument();
|
|
70
|
+
expect(screen.getByText('Users')).toBeInTheDocument();
|
|
71
|
+
expect(screen.getByText('/api/v1/user')).toBeInTheDocument();
|
|
72
|
+
expect(screen.getByText('Stable')).toBeInTheDocument();
|
|
73
|
+
expect(screen.getByText('Protected')).toBeInTheDocument();
|
|
74
|
+
expect(screen.getByText('UI Only')).toBeInTheDocument();
|
|
75
|
+
expect(screen.getByText('apikey.read')).toBeInTheDocument();
|
|
76
|
+
expect(screen.getByText('apikey.write')).toBeInTheDocument();
|
|
77
|
+
expect(screen.getByText(/Data Block:/)).toBeInTheDocument();
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
const mockModifyDocumentation = vi.hoisted(() => vi.fn((md) => `modified:${md.slice(0, 10)}`));
|
|
6
|
+
vi.mock('@tui/core', () => ({
|
|
7
|
+
PageCenter: ({ children }) => _jsx("div", { children: children })
|
|
8
|
+
}));
|
|
9
|
+
vi.mock('components/elements/display/Markdown', () => ({
|
|
10
|
+
default: ({ md }) => _jsx("div", { children: md })
|
|
11
|
+
}));
|
|
12
|
+
vi.mock('components/hooks/useScrollRestoration', () => ({
|
|
13
|
+
useScrollRestoration: vi.fn()
|
|
14
|
+
}));
|
|
15
|
+
vi.mock('plugins/store', () => ({
|
|
16
|
+
default: { plugins: [] }
|
|
17
|
+
}));
|
|
18
|
+
vi.mock('react-i18next', () => ({
|
|
19
|
+
useTranslation: () => ({ i18n: { language: 'en' } })
|
|
20
|
+
}));
|
|
21
|
+
vi.mock('react-pluggable', () => ({
|
|
22
|
+
usePluginStore: () => ({})
|
|
23
|
+
}));
|
|
24
|
+
vi.mock('utils/utils', () => ({
|
|
25
|
+
modifyDocumentation: mockModifyDocumentation
|
|
26
|
+
}));
|
|
27
|
+
import AuthDocumentation from './AuthDocumentation';
|
|
28
|
+
describe('AuthDocumentation', () => {
|
|
29
|
+
it('renders transformed authentication markdown', () => {
|
|
30
|
+
render(_jsx(AuthDocumentation, {}));
|
|
31
|
+
expect(screen.getByText(/^modified:/)).toBeInTheDocument();
|
|
32
|
+
expect(mockModifyDocumentation).toHaveBeenCalled();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
const mockModifyDocumentation = vi.hoisted(() => vi.fn((md) => `client:${md.slice(0, 10)}`));
|
|
6
|
+
vi.mock('@tui/core', () => ({
|
|
7
|
+
PageCenter: ({ children }) => _jsx("div", { children: children })
|
|
8
|
+
}));
|
|
9
|
+
vi.mock('components/elements/display/Markdown', () => ({
|
|
10
|
+
default: ({ md }) => _jsx("div", { children: md })
|
|
11
|
+
}));
|
|
12
|
+
vi.mock('components/hooks/useScrollRestoration', () => ({
|
|
13
|
+
useScrollRestoration: vi.fn()
|
|
14
|
+
}));
|
|
15
|
+
vi.mock('plugins/store', () => ({
|
|
16
|
+
default: { plugins: [] }
|
|
17
|
+
}));
|
|
18
|
+
vi.mock('react-i18next', () => ({
|
|
19
|
+
useTranslation: () => ({ i18n: { language: 'fr' } })
|
|
20
|
+
}));
|
|
21
|
+
vi.mock('react-pluggable', () => ({
|
|
22
|
+
usePluginStore: () => ({})
|
|
23
|
+
}));
|
|
24
|
+
vi.mock('utils/utils', () => ({
|
|
25
|
+
modifyDocumentation: mockModifyDocumentation
|
|
26
|
+
}));
|
|
27
|
+
import ClientDocumentation from './ClientDocumentation';
|
|
28
|
+
describe('ClientDocumentation', () => {
|
|
29
|
+
it('renders transformed client markdown', () => {
|
|
30
|
+
render(_jsx(ClientDocumentation, {}));
|
|
31
|
+
expect(screen.getByText(/^client:/)).toBeInTheDocument();
|
|
32
|
+
expect(mockModifyDocumentation).toHaveBeenCalled();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
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 mockExecuteFunction = vi.hoisted(() => vi.fn(() => _jsx("div", { children: "plugin help" }, "plugin-help")));
|
|
6
|
+
vi.mock('@tui/core', () => ({
|
|
7
|
+
PageCenter: ({ children }) => _jsx("div", { children: children })
|
|
8
|
+
}));
|
|
9
|
+
vi.mock('components/hooks/useMyPreferences', () => ({
|
|
10
|
+
default: () => ({
|
|
11
|
+
leftnav: {
|
|
12
|
+
menus: [
|
|
13
|
+
{
|
|
14
|
+
id: 'help',
|
|
15
|
+
items: [
|
|
16
|
+
{ id: 'help.main', i18nKey: 'help.main', route: '/help/main', icon: _jsx("span", { children: "skip" }) },
|
|
17
|
+
{ id: 'help.hit', i18nKey: 'help.hit', route: '/help/hit', icon: _jsx("span", { children: "hit" }) },
|
|
18
|
+
{ id: 'help.actions', i18nKey: 'help.actions', route: '/help/actions', icon: _jsx("span", { children: "action" }) }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
}));
|
|
25
|
+
vi.mock('components/hooks/useScrollRestoration', () => ({
|
|
26
|
+
useScrollRestoration: vi.fn()
|
|
27
|
+
}));
|
|
28
|
+
vi.mock('plugins/store', () => ({
|
|
29
|
+
default: {
|
|
30
|
+
operations: ['triage'],
|
|
31
|
+
plugins: ['sample-plugin']
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
vi.mock('react-i18next', () => ({
|
|
35
|
+
useTranslation: () => ({ t: (key) => key })
|
|
36
|
+
}));
|
|
37
|
+
vi.mock('react-pluggable', () => ({
|
|
38
|
+
usePluginStore: () => ({ executeFunction: mockExecuteFunction })
|
|
39
|
+
}));
|
|
40
|
+
vi.mock('react-router', async () => {
|
|
41
|
+
const { forwardRef } = await import('react');
|
|
42
|
+
return {
|
|
43
|
+
Link: forwardRef(({ to, children, ...props }, ref) => (_jsx("a", { ref: ref, href: to, ...props, children: children })))
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
import HelpDashboard from './Help';
|
|
47
|
+
describe('HelpDashboard', () => {
|
|
48
|
+
it('renders help cards, action tabs, and plugin help content', () => {
|
|
49
|
+
render(_jsx(HelpDashboard, {}));
|
|
50
|
+
expect(screen.getByText('page.help.title')).toBeInTheDocument();
|
|
51
|
+
expect(screen.getByText('help.hit')).toBeInTheDocument();
|
|
52
|
+
expect(screen.getByText('help.actions')).toBeInTheDocument();
|
|
53
|
+
expect(screen.getByRole('link', { name: 'triage' })).toHaveAttribute('href', '/help/actions?tab=triage');
|
|
54
|
+
expect(screen.getByText('plugin help')).toBeInTheDocument();
|
|
55
|
+
expect(mockExecuteFunction).toHaveBeenCalledWith('sample-plugin.help');
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
vi.mock('components/elements/display/HowlerCard', () => ({
|
|
6
|
+
default: ({ children }) => _jsx("div", { children: children })
|
|
7
|
+
}));
|
|
8
|
+
vi.mock('components/elements/display/json/JSONViewer', () => ({
|
|
9
|
+
default: ({ data }) => _jsxs("div", { children: ["json:", data.howler.id] })
|
|
10
|
+
}));
|
|
11
|
+
vi.mock('components/elements/hit/HitBanner', () => ({
|
|
12
|
+
default: ({ hit, layout }) => (_jsxs("div", { children: ["banner:", hit.howler.id, ":", layout] }))
|
|
13
|
+
}));
|
|
14
|
+
vi.mock('react-i18next', () => ({
|
|
15
|
+
useTranslation: () => ({ t: (key) => key })
|
|
16
|
+
}));
|
|
17
|
+
import HitBannerDocumentation from './HitBannerDocumentation';
|
|
18
|
+
describe('HitBannerDocumentation', () => {
|
|
19
|
+
it('renders the sample hit banner and JSON viewer', () => {
|
|
20
|
+
render(_jsx(HitBannerDocumentation, {}));
|
|
21
|
+
expect(screen.getByText('help.hit.banner.title')).toBeInTheDocument();
|
|
22
|
+
expect(screen.getByText(/banner:howler.id/)).toBeInTheDocument();
|
|
23
|
+
expect(screen.getByText('json:howler.id')).toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/// <reference types="vitest" />
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
6
|
+
const mockUseMediaQuery = vi.hoisted(() => vi.fn(() => false));
|
|
7
|
+
const mockSetSearchParams = vi.hoisted(() => vi.fn());
|
|
8
|
+
const searchParams = new URLSearchParams({ tab: 'schema' });
|
|
9
|
+
vi.mock('@mui/material', async (importOriginal) => {
|
|
10
|
+
const actual = await importOriginal();
|
|
11
|
+
return {
|
|
12
|
+
...actual,
|
|
13
|
+
useMediaQuery: mockUseMediaQuery
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
vi.mock('@tui/core', () => ({
|
|
17
|
+
PageCenter: ({ children }) => _jsx("div", { children: children })
|
|
18
|
+
}));
|
|
19
|
+
vi.mock('components/hooks/useScrollRestoration', () => ({
|
|
20
|
+
useScrollRestoration: vi.fn()
|
|
21
|
+
}));
|
|
22
|
+
vi.mock('react-i18next', () => ({
|
|
23
|
+
useTranslation: () => ({ t: (key) => key })
|
|
24
|
+
}));
|
|
25
|
+
vi.mock('react-router', () => ({
|
|
26
|
+
useSearchParams: () => [searchParams, mockSetSearchParams]
|
|
27
|
+
}));
|
|
28
|
+
vi.mock('./components/HelpTabs', () => ({
|
|
29
|
+
default: ({ children }) => _jsx("div", { children: children })
|
|
30
|
+
}));
|
|
31
|
+
vi.mock('./HitBannerDocumentation', () => ({
|
|
32
|
+
default: () => _jsx("div", { children: "banner doc" })
|
|
33
|
+
}));
|
|
34
|
+
vi.mock('./HitLabelsDocumentation', () => ({
|
|
35
|
+
default: () => _jsx("div", { children: "labels doc" })
|
|
36
|
+
}));
|
|
37
|
+
vi.mock('./HitLinksDocumentation', () => ({
|
|
38
|
+
default: () => _jsx("div", { children: "links doc" })
|
|
39
|
+
}));
|
|
40
|
+
vi.mock('./HitSchemaDocumentation', () => ({
|
|
41
|
+
default: () => _jsx("div", { children: "schema doc" })
|
|
42
|
+
}));
|
|
43
|
+
import HitDocumentation from './HitDocumentation';
|
|
44
|
+
describe('HitDocumentation', () => {
|
|
45
|
+
it('renders the selected hit doc tab and updates the query string on tab changes', async () => {
|
|
46
|
+
const user = userEvent.setup();
|
|
47
|
+
render(_jsx(HitDocumentation, {}));
|
|
48
|
+
expect(screen.getByText('schema doc')).toBeInTheDocument();
|
|
49
|
+
await user.click(screen.getByRole('tab', { name: 'help.hit.links.title' }));
|
|
50
|
+
expect(screen.getByText('links doc')).toBeInTheDocument();
|
|
51
|
+
expect(mockSetSearchParams).toHaveBeenCalled();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
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('react-i18next', () => ({
|
|
6
|
+
useTranslation: () => ({ t: (key) => `${key} - description` })
|
|
7
|
+
}));
|
|
8
|
+
import HitLabelsDocumentation from './HitLabelsDocumentation';
|
|
9
|
+
describe('HitLabelsDocumentation', () => {
|
|
10
|
+
it('renders label rows and translated descriptions for the configured label types', () => {
|
|
11
|
+
render(_jsx(HitLabelsDocumentation, {}));
|
|
12
|
+
expect(screen.getByText('help.hit.labels.title - description')).toBeInTheDocument();
|
|
13
|
+
expect(screen.getByText('Insight')).toBeInTheDocument();
|
|
14
|
+
expect(screen.getAllByText('description').length).toBeGreaterThan(0);
|
|
15
|
+
expect(screen.getByText('threat')).toBeInTheDocument();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
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('components/elements/display/Markdown', () => ({
|
|
6
|
+
default: ({ md }) => _jsx("div", { children: md })
|
|
7
|
+
}));
|
|
8
|
+
vi.mock('react-i18next', () => ({
|
|
9
|
+
useTranslation: () => ({ i18n: { language: 'en' } })
|
|
10
|
+
}));
|
|
11
|
+
import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
|
|
12
|
+
import HitLinksDocumentation from './HitLinksDocumentation';
|
|
13
|
+
describe('HitLinksDocumentation', () => {
|
|
14
|
+
it('injects configured application names into the help markdown', () => {
|
|
15
|
+
render(_jsx(ApiConfigContext.Provider, { value: {
|
|
16
|
+
config: {
|
|
17
|
+
configuration: {
|
|
18
|
+
ui: {
|
|
19
|
+
apps: [{ name: 'Alpha' }, { name: 'Beta' }]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}, children: _jsx(HitLinksDocumentation, {}) }));
|
|
24
|
+
expect(screen.getByText(/`alpha`/)).toBeInTheDocument();
|
|
25
|
+
expect(screen.getByText(/`beta`/)).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/// <reference types="vitest" />
|
|
3
|
+
import { act, fireEvent, render, screen } from '@testing-library/react';
|
|
4
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
+
const mockSetSearchParams = vi.hoisted(() => vi.fn());
|
|
6
|
+
const searchParams = new URLSearchParams();
|
|
7
|
+
vi.mock('@tui/core', () => ({}));
|
|
8
|
+
vi.mock('components/elements/display/Markdown', () => ({
|
|
9
|
+
default: ({ md }) => _jsx("div", { children: md })
|
|
10
|
+
}));
|
|
11
|
+
vi.mock('react-i18next', () => ({
|
|
12
|
+
useTranslation: () => ({
|
|
13
|
+
i18n: { language: 'en' },
|
|
14
|
+
t: (key) => key
|
|
15
|
+
})
|
|
16
|
+
}));
|
|
17
|
+
vi.mock('react-router', () => ({
|
|
18
|
+
useSearchParams: () => [searchParams, mockSetSearchParams]
|
|
19
|
+
}));
|
|
20
|
+
import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
|
|
21
|
+
import HitSchemaDocumentation from './HitSchemaDocumentation';
|
|
22
|
+
const config = {
|
|
23
|
+
indexes: {
|
|
24
|
+
hit: {
|
|
25
|
+
'howler.id': {
|
|
26
|
+
type: 'keyword',
|
|
27
|
+
description: 'Primary identifier',
|
|
28
|
+
list: true,
|
|
29
|
+
deprecated: true,
|
|
30
|
+
regex: '^id-.*$',
|
|
31
|
+
values: ['one', 'two'],
|
|
32
|
+
deprecated_description: 'Use another field'
|
|
33
|
+
},
|
|
34
|
+
'event.action': {
|
|
35
|
+
type: 'text',
|
|
36
|
+
description: 'Action field',
|
|
37
|
+
values: []
|
|
38
|
+
},
|
|
39
|
+
'howler.id.key_a': {
|
|
40
|
+
type: 'keyword',
|
|
41
|
+
description: 'shadow'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
describe('HitSchemaDocumentation', () => {
|
|
47
|
+
it('renders grouped field tables and filters them through the throttled search input', async () => {
|
|
48
|
+
vi.useFakeTimers();
|
|
49
|
+
render(_jsx(ApiConfigContext.Provider, { value: { config }, children: _jsx(HitSchemaDocumentation, {}) }));
|
|
50
|
+
expect(screen.getByText('howler.id')).toBeInTheDocument();
|
|
51
|
+
expect(screen.getByText('event.action')).toBeInTheDocument();
|
|
52
|
+
expect(screen.getByText('list')).toBeInTheDocument();
|
|
53
|
+
expect(screen.getByText('deprecated')).toBeInTheDocument();
|
|
54
|
+
expect(screen.getByText('help.hit.schema.regex')).toBeInTheDocument();
|
|
55
|
+
expect(screen.getByText('Use another field')).toBeInTheDocument();
|
|
56
|
+
fireEvent.change(screen.getByLabelText('help.hit.schema.search.prompt'), { target: { value: 'primary' } });
|
|
57
|
+
await act(async () => {
|
|
58
|
+
await vi.advanceTimersByTimeAsync(300);
|
|
59
|
+
});
|
|
60
|
+
expect(screen.getByText('howler.id')).toBeInTheDocument();
|
|
61
|
+
expect(screen.queryByText('event.action')).not.toBeInTheDocument();
|
|
62
|
+
expect(mockSetSearchParams).toHaveBeenCalled();
|
|
63
|
+
fireEvent.click(screen.getByRole('button'));
|
|
64
|
+
expect(screen.getByDisplayValue('')).toBeInTheDocument();
|
|
65
|
+
vi.useRealTimers();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
const mockModifyDocumentation = vi.hoisted(() => vi.fn((md) => `notebook:${md.slice(0, 10)}`));
|
|
6
|
+
vi.mock('@tui/core', () => ({
|
|
7
|
+
PageCenter: ({ children }) => _jsx("div", { children: children })
|
|
8
|
+
}));
|
|
9
|
+
vi.mock('components/elements/display/Markdown', () => ({
|
|
10
|
+
default: ({ md }) => _jsx("div", { children: md })
|
|
11
|
+
}));
|
|
12
|
+
vi.mock('components/hooks/useScrollRestoration', () => ({
|
|
13
|
+
useScrollRestoration: vi.fn()
|
|
14
|
+
}));
|
|
15
|
+
vi.mock('plugins/store', () => ({
|
|
16
|
+
default: { plugins: [] }
|
|
17
|
+
}));
|
|
18
|
+
vi.mock('react-i18next', () => ({
|
|
19
|
+
useTranslation: () => ({ i18n: { language: 'en' } })
|
|
20
|
+
}));
|
|
21
|
+
vi.mock('react-pluggable', () => ({
|
|
22
|
+
usePluginStore: () => ({})
|
|
23
|
+
}));
|
|
24
|
+
vi.mock('utils/utils', () => ({
|
|
25
|
+
modifyDocumentation: mockModifyDocumentation
|
|
26
|
+
}));
|
|
27
|
+
import NotebookDocumentation from './NotebookDocumentation';
|
|
28
|
+
describe('NotebookDocumentation', () => {
|
|
29
|
+
it('renders transformed notebook markdown', () => {
|
|
30
|
+
render(_jsx(NotebookDocumentation, {}));
|
|
31
|
+
expect(screen.getByText(/^notebook:/)).toBeInTheDocument();
|
|
32
|
+
expect(mockModifyDocumentation).toHaveBeenCalled();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
PageCenter: ({ children }) => _jsx("div", { children: children })
|
|
7
|
+
}));
|
|
8
|
+
vi.mock('components/elements/display/HandlebarsMarkdown', () => ({
|
|
9
|
+
default: ({ md }) => _jsx("div", { children: md })
|
|
10
|
+
}));
|
|
11
|
+
vi.mock('components/hooks/useScrollRestoration', () => ({
|
|
12
|
+
useScrollRestoration: vi.fn()
|
|
13
|
+
}));
|
|
14
|
+
vi.mock('../overviews/startingTemplate', () => ({
|
|
15
|
+
useStartingTemplate: () => 'starting template'
|
|
16
|
+
}));
|
|
17
|
+
vi.mock('../ErrorBoundary', () => ({
|
|
18
|
+
default: ({ children }) => _jsx("div", { children: children })
|
|
19
|
+
}));
|
|
20
|
+
import OverviewDocumentation from './OverviewDocumentation';
|
|
21
|
+
describe('OverviewDocumentation', () => {
|
|
22
|
+
it('renders the starting overview template inside the markdown renderer', () => {
|
|
23
|
+
render(_jsx(OverviewDocumentation, {}));
|
|
24
|
+
expect(screen.getByText('starting template')).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|