From cc0541b2f45d6b534decc56ac71d998ed71e5e1b Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Mon, 2 Oct 2023 17:40:14 +0200 Subject: [PATCH] SONAR-20323 Remove last enzyme tests --- server/sonar-web/config/jest/SetupEnzyme.ts | 23 - server/sonar-web/jest.config.js | 3 +- server/sonar-web/package.json | 4 - .../PendingPluginsActionNotif-test.tsx | 91 - .../settings/__tests__/SettingsNav-test.tsx | 75 - .../__tests__/SystemRestartNotif-test.tsx | 26 - .../PendingPluginsActionNotif-test.tsx.snap | 63 - .../__snapshots__/SettingsNav-test.tsx.snap | 442 ---- .../SystemRestartNotif-test.tsx.snap | 23 - .../__tests__/PromotionNotification-test.tsx | 80 - .../PromotionNotification-test.tsx.snap | 54 - .../__tests__/UpdateNotification-test.tsx | 195 -- .../UpdateNotification-test.tsx.snap | 26 - .../sidebar/__tests__/ListStyleFacet-test.tsx | 219 -- .../ListStyleFacet-test.tsx.snap | 480 ---- .../__tests__/QualityProfilesApp-it.tsx | 2 +- .../__tests__/SourceViewerCode-test.tsx | 86 - .../__tests__/LineIssueList-test.tsx | 54 - .../__tests__/MeasuresOverlay-test.tsx | 182 -- .../__tests__/MeasuresOverlayMeasure-test.tsx | 48 - .../__snapshots__/LineIssueList-test.tsx.snap | 65 - .../MeasuresOverlay-test.tsx.snap | 1849 ------------- .../MeasuresOverlayMeasure-test.tsx.snap | 53 - .../a11y/__tests__/A11yLinks-test.tsx | 93 + .../a11y/__tests__/A11yProvider-test.tsx | 69 - .../a11y/__tests__/A11ySkipLinks-test.tsx | 39 - .../a11y/__tests__/A11ySkipTarget-test.tsx | 41 - .../__snapshots__/A11ySkipLinks-test.tsx.snap | 20 - .../A11ySkipTarget-test.tsx.snap | 32 - .../charts/__tests__/BarChart-test.tsx | 80 - .../__tests__/ColorGradientLegend-test.tsx | 40 - .../charts/__tests__/DonutChart-test.tsx | 47 - .../charts/__tests__/LineChart-test.tsx | 54 - .../ColorGradientLegend-test.tsx.snap | 220 -- .../__snapshots__/DonutChart-test.tsx.snap | 122 - .../components/common/DocumentationLink.tsx | 29 - .../common/__tests__/CodeSnippet-test.tsx | 37 - .../DisableableSelectOption-test.tsx | 46 - .../common/__tests__/InstanceMessage-test.tsx | 52 - .../common/__tests__/MeasuresLink-test.tsx | 33 - .../common/__tests__/PageCounter-test.tsx | 33 - .../__tests__/PrivacyBadgeContainer-test.tsx | 41 - .../common/__tests__/ProjectKeyInput-test.tsx | 48 - .../__tests__/ResetPasswordForm-test.tsx | 109 - .../common/__tests__/RestartButton-test.tsx | 30 - .../common/__tests__/SatusIndicator-test.tsx | 33 - .../__snapshots__/CodeSnippet-test.tsx.snap | 67 - .../DisableableSelectOption-test.tsx.snap | 42 - .../__snapshots__/MeasuresLink-test.tsx.snap | 61 - .../__snapshots__/PageCounter-test.tsx.snap | 17 - .../PrivacyBadgeContainer-test.tsx.snap | 25 - .../ProjectKeyInput-test.tsx.snap | 154 -- .../ResetPasswordForm-test.tsx.snap | 89 - .../__snapshots__/RestartButton-test.tsx.snap | 28 - .../SatusIndicator-test.tsx.snap | 34 - .../__tests__/ActionsDropdown-test.tsx | 85 - .../controls/__tests__/BackButton-test.tsx | 40 - .../controls/__tests__/BoxedTabs-test.tsx | 66 - .../__tests__/ClickEventBoundary-test.tsx | 49 - .../controls/__tests__/DateInput-test.tsx | 101 - .../__tests__/DateRangeInput-test.tsx | 60 - .../controls/__tests__/Dropdown-test.tsx | 113 - .../controls/__tests__/HelpTooltip-test.tsx | 32 - .../__tests__/IdentityProviderLink-test.tsx | 44 - .../__tests__/InputValidationField-test.tsx | 44 - .../__tests__/ModalValidationField-test.tsx | 50 - .../controls/__tests__/Radio-test.tsx | 52 - .../controls/__tests__/RadioCard-test.tsx | 60 - .../controls/__tests__/ReloadButton-test.tsx | 40 - .../__tests__/ScreenPositionFixer-test.tsx | 94 - .../controls/__tests__/SearchBox-test.tsx | 90 - .../controls/__tests__/Select-test.tsx | 105 - .../controls/__tests__/SimpleModal-test.tsx | 65 - .../controls/__tests__/Toggle-test.tsx | 41 - .../controls/__tests__/Tooltip-test.tsx | 126 - .../__tests__/ValidationForm-test.tsx | 44 - .../__tests__/ValidationInput-test.tsx | 65 - .../__tests__/ValidationModal-test.tsx | 68 - .../ActionsDropdown-test.tsx.snap | 105 - .../__snapshots__/BackButton-test.tsx.snap | 49 - .../__snapshots__/BoxedTabs-test.tsx.snap | 1368 ---------- .../ClickEventBoundary-test.tsx.snap | 14 - .../__snapshots__/DateInput-test.tsx.snap | 184 -- .../DateRangeInput-test.tsx.snap | 155 -- .../__snapshots__/HelpTooltip-test.tsx.snap | 49 - .../IdentityProviderLink-test.tsx.snap | 21 - .../InputValidationField-test.tsx.snap | 13 - .../ModalValidationField-test.tsx.snap | 71 - .../__snapshots__/Radio-test.tsx.snap | 29 - .../__snapshots__/RadioCard-test.tsx.snap | 173 -- .../__snapshots__/ReloadButton-test.tsx.snap | 47 - .../__snapshots__/SearchBox-test.tsx.snap | 41 - .../__snapshots__/Select-test.tsx.snap | 2325 ----------------- .../__snapshots__/SimpleModal-test.tsx.snap | 52 - .../__snapshots__/Toggle-test.tsx.snap | 58 - .../__snapshots__/Tooltip-test.tsx.snap | 62 - .../ValidationForm-test.tsx.snap | 16 - .../ValidationInput-test.tsx.snap | 162 -- .../ValidationModal-test.tsx.snap | 114 - .../__snapshots__/buttons-test.tsx.snap | 31 - .../controls/__tests__/buttons-test.tsx | 77 - .../facet/__tests__/ListStyleFacet-test.tsx | 221 -- .../__tests__/ListStyleFacetFooter-test.tsx | 57 - .../__tests__/MultipleSelectionHint-test.tsx | 46 - .../ListStyleFacet-test.tsx.snap | 436 ---- .../ListStyleFacetFooter-test.tsx.snap | 45 - .../MultipleSelectionHint-test.tsx.snap | 25 - .../withNotifications-test.tsx.snap | 48 - .../hoc/__tests__/whenLoggedIn-test.tsx | 62 - .../__tests__/withCLanguageFeature-test.tsx | 46 - .../__tests__/withIndexationContext-test.tsx | 54 - .../__tests__/withKeyboardNavigation-test.tsx | 159 -- .../hoc/__tests__/withNotifications-test.tsx | 93 - .../icons/__tests__/IssueIcon-test.tsx | 34 - .../icons/__tests__/IssueTypeIcon-test.tsx | 34 - .../icons/__tests__/TestStatusIcon-test.tsx | 33 - .../__snapshots__/IssueIcon-test.tsx.snap | 9 - .../__snapshots__/IssueTypeIcon-test.tsx.snap | 26 - .../TestStatusIcon-test.tsx.snap | 9 - .../CrossFileLocationsNavigator-test.tsx | 96 - .../__tests__/LocationsList-test.tsx | 60 - .../CrossFileLocationsNavigator-test.tsx.snap | 109 - .../__snapshots__/LocationsList-test.tsx.snap | 30 - .../measure/__tests__/Measure-test.tsx | 61 - .../__tests__/RatingTooltipContent-test.tsx | 62 - .../__snapshots__/Measure-test.tsx.snap | 42 - .../RatingTooltipContent-test.tsx.snap | 37 - .../shared/__tests__/DrilldownLink-test.tsx | 39 - .../__snapshots__/DrilldownLink-test.tsx.snap | 28 - .../js/components/ui/__tests__/Alert-test.tsx | 58 - .../ui/__tests__/AutoEllipsis-test.tsx | 75 - .../ui/__tests__/CoverageRating-test.tsx | 57 - .../ui/__tests__/DismissableAlert-test.tsx | 71 - .../ui/__tests__/GenericAvatar-test.tsx | 27 - .../ui/__tests__/LegacyAvatar-test.tsx | 57 - .../js/components/ui/__tests__/Level-test.tsx | 36 - .../__tests__/MandatoryFieldMarker-test.tsx | 31 - .../components/ui/__tests__/NavBar-test.tsx | 40 - .../components/ui/__tests__/NewsBox-test.tsx | 43 - .../components/ui/__tests__/Rating-test.tsx | 41 - .../ui/__tests__/SizeRating-test.tsx | 34 - .../__snapshots__/Alert-test.tsx.snap | 152 -- .../__snapshots__/AutoEllipsis-test.tsx.snap | 9 - .../CoverageRating-test.tsx.snap | 22 - .../DismissableAlert-test.tsx.snap | 26 - .../__snapshots__/GenericAvatar-test.tsx.snap | 47 - .../__snapshots__/LegacyAvatar-test.tsx.snap | 18 - .../__snapshots__/Level-test.tsx.snap | 43 - .../MandatoryFieldMarker-test.tsx.snap | 19 - .../__snapshots__/NavBar-test.tsx.snap | 64 - .../__snapshots__/NewsBox-test.tsx.snap | 42 - .../__snapshots__/Rating-test.tsx.snap | 48 - .../__snapshots__/SizeRating-test.tsx.snap | 46 - .../__snapshots__/popups-test.tsx.snap | 79 - .../components/ui/__tests__/popups-test.tsx | 128 - .../update-center/__tests__/MetaData-test.tsx | 86 - .../__tests__/MetaDataVersion-test.tsx | 45 - .../__tests__/MetaDataVersions-test.tsx | 51 - .../__snapshots__/MetaData-test.tsx.snap | 133 - .../MetaDataVersion-test.tsx.snap | 113 - .../MetaDataVersions-test.tsx.snap | 28 - .../components/upgrade/SystemUpgradeForm.tsx | 5 +- .../upgrade/__tests__/SystemUpgrade-test.tsx | 88 + .../__tests__/SystemUpgradeButton-test.tsx | 38 - .../__tests__/SystemUpgradeForm-test.tsx | 89 - .../SystemUpgradeIntermediate-test.tsx | 58 - .../__tests__/SystemUpgradeItem-test.tsx | 85 - .../SystemUpgradeButton-test.tsx.snap | 12 - .../SystemUpgradeForm-test.tsx.snap | 494 ---- .../SystemUpgradeIntermediate-test.tsx.snap | 63 - .../SystemUpgradeItem-test.tsx.snap | 668 ----- .../src/main/js/helpers/testUtils.ts | 137 - server/sonar-web/yarn.lock | 625 +---- 173 files changed, 201 insertions(+), 18689 deletions(-) delete mode 100644 server/sonar-web/config/jest/SetupEnzyme.ts delete mode 100644 server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx delete mode 100644 server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx delete mode 100644 server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SystemRestartNotif-test.tsx delete mode 100644 server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/PendingPluginsActionNotif-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SystemRestartNotif-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx delete mode 100644 server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/__snapshots__/PromotionNotification-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx delete mode 100644 server/sonar-web/src/main/js/app/components/update-notification/__tests__/__snapshots__/UpdateNotification-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ListStyleFacet-test.tsx delete mode 100644 server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayMeasure-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/components/a11y/__tests__/A11yLinks-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/a11y/__tests__/A11yProvider-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipTarget-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/ColorGradientLegend-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/DonutChart-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/common/DocumentationLink.tsx delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/CodeSnippet-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/InstanceMessage-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/MeasuresLink-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/PageCounter-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/ProjectKeyInput-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/RestartButton-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/SatusIndicator-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/CodeSnippet-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/DisableableSelectOption-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MeasuresLink-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PageCounter-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ProjectKeyInput-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ResetPasswordForm-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/RestartButton-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/SatusIndicator-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/BackButton-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/ClickEventBoundary-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/DateInput-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/DateRangeInput-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/Dropdown-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/HelpTooltip-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/IdentityProviderLink-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/InputValidationField-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/ModalValidationField-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/Radio-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/RadioCard-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/ReloadButton-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/SearchBox-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/Select-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/SimpleModal-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/Toggle-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/Tooltip-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/ValidationForm-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/ValidationInput-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BoxedTabs-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ClickEventBoundary-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateInput-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateRangeInput-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/HelpTooltip-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/IdentityProviderLink-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/InputValidationField-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ModalValidationField-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Radio-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/RadioCard-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ReloadButton-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Select-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Toggle-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationForm-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationModal-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/buttons-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/controls/__tests__/buttons-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacetFooter-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacetFooter-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/MultipleSelectionHint-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/hoc/__tests__/__snapshots__/withNotifications-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/__tests__/IssueIcon-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/__tests__/IssueTypeIcon-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/__tests__/TestStatusIcon-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueIcon-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueTypeIcon-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/TestStatusIcon-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/CrossFileLocationsNavigator-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/LocationsList-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/Measure-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/RatingTooltipContent-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/shared/__tests__/__snapshots__/DrilldownLink-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/AutoEllipsis-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/GenericAvatar-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/LegacyAvatar-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/Level-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldMarker-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/NavBar-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/NewsBox-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/Rating-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/SizeRating-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Alert-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/AutoEllipsis-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/CoverageRating-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/DismissableAlert-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/GenericAvatar-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/LegacyAvatar-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Level-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/MandatoryFieldMarker-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NavBar-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NewsBox-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Rating-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/SizeRating-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/popups-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/popups-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaData-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersion-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersions-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaData-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaDataVersion-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaDataVersions-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgrade-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeButton-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeForm-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeIntermediate-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeItem-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeButton-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeIntermediate-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap diff --git a/server/sonar-web/config/jest/SetupEnzyme.ts b/server/sonar-web/config/jest/SetupEnzyme.ts deleted file mode 100644 index 68f920f86cb..00000000000 --- a/server/sonar-web/config/jest/SetupEnzyme.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; -import Enzyme from 'enzyme'; - -Enzyme.configure({ adapter: new Adapter() }); diff --git a/server/sonar-web/jest.config.js b/server/sonar-web/jest.config.js index 92fa4a39329..4aa418c407d 100644 --- a/server/sonar-web/jest.config.js +++ b/server/sonar-web/jest.config.js @@ -15,7 +15,6 @@ module.exports = { }, setupFiles: [ '/config/polyfills.ts', - '/config/jest/SetupEnzyme.ts', '/config/jest/SetupTestEnvironment.ts', '/config/jest/SetupTheme.js', ], @@ -23,7 +22,7 @@ module.exports = { '/config/jest/SetupReactTestingLibrary.ts', '/config/jest/SetupJestAxe.ts', ], - snapshotSerializers: ['enzyme-to-json/serializer', '@emotion/jest/serializer'], + snapshotSerializers: ['@emotion/jest/serializer'], testEnvironment: 'jsdom', testPathIgnorePatterns: [ '/config', diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json index 342f7a37d21..f11e453f7c7 100644 --- a/server/sonar-web/package.json +++ b/server/sonar-web/package.json @@ -62,7 +62,6 @@ "@types/d3-shape": "3.1.2", "@types/diff": "5.0.3", "@types/dompurify": "3.0.2", - "@types/enzyme": "3.10.13", "@types/jest": "29.5.4", "@types/jest-axe": "3.5.5", "@types/lodash": "4.14.197", @@ -76,13 +75,10 @@ "@types/valid-url": "1.0.4", "@typescript-eslint/eslint-plugin": "5.59.11", "@typescript-eslint/parser": "5.59.11", - "@wojtekmaj/enzyme-adapter-react-17": "0.8.0", "autoprefixer": "10.4.15", "chalk": "4.1.2", "chokidar": "3.5.3", "design-system": "1.0.0", - "enzyme": "3.11.0", - "enzyme-to-json": "3.6.2", "esbuild": "0.19.2", "eslint": "8.48.0", "eslint-config-sonarqube": "2.1.3", diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx deleted file mode 100644 index 684f2153e93..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../../../helpers/testUtils'; -import PendingPluginsActionNotif from '../PendingPluginsActionNotif'; - -jest.mock('../../../../../api/plugins', () => ({ - cancelPendingPlugins: jest.fn(() => Promise.resolve()), -})); - -const cancelPendingPlugins = require('../../../../../api/plugins') - .cancelPendingPlugins as jest.Mock; - -beforeEach(() => { - cancelPendingPlugins.mockClear(); -}); - -it('should display pending actions', () => { - expect(getWrapper()).toMatchSnapshot(); -}); - -it('should not display anything', () => { - expect(getWrapper({ pending: { installing: [], updating: [], removing: [] } }).type()).toBeNull(); -}); - -it('should cancel all pending and refresh them', async () => { - const refreshPending = jest.fn(); - const wrapper = getWrapper({ refreshPending }); - click(wrapper.find('.js-cancel-all')); - expect(cancelPendingPlugins).toHaveBeenCalled(); - await new Promise(setImmediate); - - expect(refreshPending).toHaveBeenCalled(); -}); - -function getWrapper(props = {}) { - return shallow( - {}} - systemStatus="UP" - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx deleted file mode 100644 index fe1cf677498..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockLocation } from '../../../../../helpers/testMocks'; -import { AdminPageExtension } from '../../../../../types/extension'; -import { SettingsNav } from '../SettingsNav'; - -it('should work with extensions', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); - expect(wrapper.find('Dropdown')).toMatchSnapshot(); -}); - -it('should display a pending plugin notif', () => { - const wrapper = shallowRender({ - pendingPlugins: { - installing: [ - { - key: 'foo', - name: 'Foo', - version: '1.0', - implementationBuild: '1', - }, - ], - removing: [], - updating: [], - }, - }); - expect(wrapper.find('ContextNavBar').prop('notif')).toMatchSnapshot(); -}); - -it('should display restart notif', () => { - const wrapper = shallowRender({ systemStatus: 'RESTARTING' }); - expect(wrapper.find('ContextNavBar').prop('notif')).toMatchSnapshot(); -}); - -it('should render correctly when governance is active', () => { - expect( - shallowRender({ - extensions: [{ key: AdminPageExtension.GovernanceConsole, name: 'governance' }], - }), - ).toMatchSnapshot(); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SystemRestartNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SystemRestartNotif-test.tsx deleted file mode 100644 index 548208ed18d..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SystemRestartNotif-test.tsx +++ /dev/null @@ -1,26 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import SystemRestartNotif from '../SystemRestartNotif'; - -it('should render correctly', () => { - expect(shallow()).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/PendingPluginsActionNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/PendingPluginsActionNotif-test.tsx.snap deleted file mode 100644 index 5c98124e87b..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/PendingPluginsActionNotif-test.tsx.snap +++ /dev/null @@ -1,63 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should display pending actions 1`] = ` - -
- - - - - - 2 - , - } - } - /> - - - ; - - 1 - , - } - } - /> - - - -
-
-`; diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap deleted file mode 100644 index 9f662b53101..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap +++ /dev/null @@ -1,442 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should display a pending plugin notif 1`] = ` - -`; - -exports[`should display restart notif 1`] = ``; - -exports[`should render correctly when governance is active 1`] = ` - -
-

- layout.settings -

-
- - -
  • - - settings.page - -
  • -
  • - - property.category.security.encryption - -
  • -
  • - - webhooks.page - -
  • -
  • - - governance - -
  • - - } - tagName="li" - > - -
    - -
  • - - users.page - -
  • -
  • - - user_groups.page - -
  • -
  • - - global_permissions.page - -
  • -
  • - - permission_templates - -
  • - - } - tagName="li" - > - -
    - -
  • - - management - -
  • -
  • - - background_tasks.page - -
  • - - } - tagName="li" - > - -
    -
  • - - sidebar.system - -
  • -
  • - - marketplace.page - -
  • -
  • - - audit_logs.page - -
  • -
    -
    -`; - -exports[`should work with extensions 1`] = ` - -
    -

    - layout.settings -

    -
    - - -
  • - - settings.page - -
  • -
  • - - property.category.security.encryption - -
  • -
  • - - webhooks.page - -
  • -
  • - - Foo - -
  • - - } - tagName="li" - > - -
    - -
  • - - users.page - -
  • -
  • - - user_groups.page - -
  • -
  • - - global_permissions.page - -
  • -
  • - - permission_templates - -
  • - - } - tagName="li" - > - -
    - -
  • - - management - -
  • -
  • - - background_tasks.page - -
  • - - } - tagName="li" - > - -
    -
  • - - sidebar.system - -
  • -
  • - - marketplace.page - -
  • -
    -
    -`; - -exports[`should work with extensions 2`] = ` -[ - -
  • - - settings.page - -
  • -
  • - - property.category.security.encryption - -
  • -
  • - - webhooks.page - -
  • -
  • - - Foo - -
  • - - } - tagName="li" - > - -
    , - -
  • - - users.page - -
  • -
  • - - user_groups.page - -
  • -
  • - - global_permissions.page - -
  • -
  • - - permission_templates - -
  • - - } - tagName="li" - > - -
    , - -
  • - - management - -
  • -
  • - - background_tasks.page - -
  • - - } - tagName="li" - > - -
    , -] -`; diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SystemRestartNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SystemRestartNotif-test.tsx.snap deleted file mode 100644 index 0c0644356e9..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SystemRestartNotif-test.tsx.snap +++ /dev/null @@ -1,23 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - - - background_tasks.page - , - } - } - /> - -`; diff --git a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx b/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx deleted file mode 100644 index 85c551b6783..00000000000 --- a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import React from 'react'; -import { dismissNotice } from '../../../../api/users'; -import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; -import { waitAndUpdate } from '../../../../helpers/testUtils'; -import { NoticeType } from '../../../../types/users'; -import { CurrentUserContextInterface } from '../../current-user/CurrentUserContext'; -import { PromotionNotification } from '../PromotionNotification'; - -jest.mock('../../../../api/users', () => ({ - dismissNotice: jest.fn().mockResolvedValue({}), -})); - -beforeEach(() => { - jest.clearAllMocks(); -}); - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('anonymous'); - expect( - shallowRender({ - currentUser: mockLoggedInUser({ dismissedNotices: { [NoticeType.SONARLINT_AD]: true } }), - }), - ).toMatchSnapshot('adAlreadySeen'); - expect(shallowRender({ currentUser: mockLoggedInUser() })).toMatchSnapshot('loggedIn'); -}); - -it('should remove the toaster when click on dismiss', async () => { - const updateDismissedNotices = jest.fn(); - const wrapper = shallowRender({ - currentUser: mockLoggedInUser({ dismissedNotices: { [NoticeType.SONARLINT_AD]: false } }), - updateDismissedNotices, - }); - wrapper.find('.toaster-actions ButtonLink').simulate('click'); - expect(dismissNotice).toHaveBeenCalled(); - await waitAndUpdate(wrapper); - expect(updateDismissedNotices).toHaveBeenCalled(); -}); - -it('should remove the toaster and navigate to sonarlint when click on learn more', async () => { - const updateDismissedNotices = jest.fn(); - const wrapper = shallowRender({ - currentUser: mockLoggedInUser({ dismissedNotices: { [NoticeType.SONARLINT_AD]: false } }), - updateDismissedNotices, - }); - wrapper.find('.toaster-actions .button-primary').simulate('click'); - expect(dismissNotice).toHaveBeenCalled(); - await waitAndUpdate(wrapper); - expect(updateDismissedNotices).toHaveBeenCalled(); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/__snapshots__/PromotionNotification-test.tsx.snap b/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/__snapshots__/PromotionNotification-test.tsx.snap deleted file mode 100644 index 0fda1c82608..00000000000 --- a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/__snapshots__/PromotionNotification-test.tsx.snap +++ /dev/null @@ -1,54 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: adAlreadySeen 1`] = `""`; - -exports[`should render correctly: anonymous 1`] = `""`; - -exports[`should render correctly: loggedIn 1`] = ` -
    -
    - SonarQube + SonarLint -
    -
    - - promotion.sonarlint.title - -

    - promotion.sonarlint.content -

    -
    -
    - - learn_more - - - dismiss - -
    -
    -`; diff --git a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx b/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx deleted file mode 100644 index a3b01520871..00000000000 --- a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx +++ /dev/null @@ -1,195 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { getSystemUpgrades } from '../../../../api/system'; -import { Alert } from '../../../../components/ui/Alert'; -import DismissableAlert from '../../../../components/ui/DismissableAlert'; -import { mockSystemUpgrade } from '../../../../helpers/mocks/system-upgrades'; -import { mockAppState, mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; -import { waitAndUpdate } from '../../../../helpers/testUtils'; -import { Permissions } from '../../../../types/permissions'; -import { UpdateNotification } from '../UpdateNotification'; - -jest.mock('../../../../api/system', () => { - const { mockSystemUpgrade } = jest.requireActual('../../../../helpers/mocks/system-upgrades'); - return { - getSystemUpgrades: jest - .fn() - .mockResolvedValue({ upgrades: [mockSystemUpgrade({ version: '9.1' })], latestLTS: '8.9' }), - }; -}); - -function formatDate(date: Date): string { - return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`; -} - -it('should render correctly', async () => { - let wrapper = shallowRender({ - appState: mockAppState({ version: '9.0' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot('default'); - - wrapper = shallowRender({ - appState: mockAppState({ version: '9.0' }), - currentUser: mockCurrentUser(), - }); - expect(wrapper.type()).toBeNull(); -}); - -it('should not show prompt when not admin', async () => { - //As anonymous - const wrapper = shallowRender(); - await waitAndUpdate(wrapper); - expect(wrapper.type()).toBeNull(); - - // As non admin user - wrapper.setProps({ currentUser: mockLoggedInUser() }); - await waitAndUpdate(wrapper); - expect(wrapper.type()).toBeNull(); -}); - -it('should not show prompt when no current version', async () => { - const wrapper = shallowRender({ appState: mockAppState({ version: 'NOVERSION' }) }); - await waitAndUpdate(wrapper); - expect(wrapper.type()).toBeNull(); -}); - -it('should not show prompt when no upgrade', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ upgrades: [], latestLTS: '8.9' }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '9.1' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.type()).toBeNull(); -}); - -it('should show prompt when no lts date', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [mockSystemUpgrade({ version: '8.9', releaseDate: 'INVALID' })], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '8.1' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).props().alertKey).toBe('previous_lts8.9'); - expect(wrapper.contains('admin_notification.update.previous_lts')).toBe(true); -}); - -it('should show prompt when minor upgrade', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [mockSystemUpgrade({ version: '9.2' }), mockSystemUpgrade({ version: '9.1' })], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '9.1' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).props().alertKey).toBe('new_minor_version9.2'); - expect(wrapper.contains('admin_notification.update.new_minor_version')).toBe(true); -}); - -it('should show prompt when patch upgrade', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [mockSystemUpgrade({ version: '9.2' }), mockSystemUpgrade({ version: '9.1.1' })], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '9.1' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).props().alertKey).toBe('new_patch9.2'); - expect(wrapper.contains('admin_notification.update.new_patch')).toBe(true); -}); - -it('should show prompt when lts upgrade', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [ - mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(new Date(Date.now())) }), - mockSystemUpgrade({ version: '9.2' }), - mockSystemUpgrade({ version: '9.1.1' }), - ], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '8.8' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).props().alertKey).toBe('pre_lts8.9'); - expect(wrapper.contains('admin_notification.update.pre_lts')).toBe(true); -}); - -it('should show prompt when lts upgrade is more than 6 month', async () => { - const ltsDate = new Date(Date.now()); - ltsDate.setMonth(ltsDate.getMonth() - 7); - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [ - mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(ltsDate) }), - mockSystemUpgrade({ version: '9.2' }), - mockSystemUpgrade({ version: '9.1.1' }), - ], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '8.8' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).props().alertKey).toBe('previous_lts8.9'); - expect(wrapper.contains('admin_notification.update.previous_lts')).toBe(true); -}); - -it('should show correct alert when not dismissable', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [ - mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(new Date(Date.now())) }), - mockSystemUpgrade({ version: '9.2' }), - mockSystemUpgrade({ version: '9.1.1' }), - ], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '8.8' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).type).toBeDefined(); - wrapper.setProps({ dismissable: false }); - expect(wrapper.find(Alert).type).toBeDefined(); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/__snapshots__/UpdateNotification-test.tsx.snap b/server/sonar-web/src/main/js/app/components/update-notification/__tests__/__snapshots__/UpdateNotification-test.tsx.snap deleted file mode 100644 index 64487bc4c38..00000000000 --- a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/__snapshots__/UpdateNotification-test.tsx.snap +++ /dev/null @@ -1,26 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: default 1`] = ` - - admin_notification.update.new_minor_version - - -`; diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ListStyleFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ListStyleFacet-test.tsx deleted file mode 100644 index 7b627fbae35..00000000000 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ListStyleFacet-test.tsx +++ /dev/null @@ -1,219 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import { shallow, ShallowWrapper } from 'enzyme'; -import * as React from 'react'; -import { waitAndUpdate } from '../../../../helpers/testUtils'; -import { ListStyleFacet, Props } from '../ListStyleFacet'; - -it('should render', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should select items', () => { - const onChange = jest.fn(); - const wrapper = shallowRender({ onChange }); - const instance = wrapper.instance() as ListStyleFacet; - - // select one item - instance.handleItemClick('b', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b'] }); - wrapper.setProps({ values: ['b'] }); - - // select another item - instance.handleItemClick('a', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['a'] }); - wrapper.setProps({ values: ['a'] }); - - // unselect item - instance.handleItemClick('a', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: [] }); - wrapper.setProps({ values: [] }); - - // select multiple items - wrapper.setProps({ values: ['b'] }); - instance.handleItemClick('c', true); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b', 'c'] }); - wrapper.setProps({ values: ['b', 'c'] }); - - // unselect item - instance.handleItemClick('c', true); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b'] }); -}); - -it('should toggle', () => { - const onToggle = jest.fn(); - const wrapper = shallowRender({ onToggle }); - wrapper.find('FacetBox').prop('onClick')(); - expect(onToggle).toHaveBeenCalled(); -}); - -it('should clear', () => { - const onChange = jest.fn(); - const wrapper = shallowRender({ onChange, values: ['a'] }); - wrapper.find('FacetBox').prop('onClear')(); - expect(onChange).toHaveBeenCalledWith({ foo: [] }); -}); - -it('should search', async () => { - const onSearch = jest.fn().mockResolvedValue({ - results: ['d', 'e'], - paging: { pageIndex: 1, pageSize: 2, total: 3 }, - }); - - const loadSearchResultCount = jest.fn().mockResolvedValue({ d: 7, e: 3 }); - const wrapper = shallowRender({ loadSearchResultCount, onSearch }); - - // search - wrapper.find('InputSearch').prop('onChange')('query'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('query'); - expect(loadSearchResultCount).toHaveBeenLastCalledWith(['d', 'e']); - - // load more results - onSearch.mockResolvedValue({ - results: ['f'], - paging: { pageIndex: 2, pageSize: 2, total: 3 }, - }); - - loadSearchResultCount.mockResolvedValue({ f: 5 }); - wrapper.find('ListFooter').prop('loadMore')(); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('query', 2); - - // clear search - onSearch.mockClear(); - loadSearchResultCount.mockClear(); - wrapper.find('InputSearch').prop('onChange')(''); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).not.toHaveBeenCalled(); - expect(loadSearchResultCount).not.toHaveBeenCalled(); - - // search for no results - onSearch.mockResolvedValue({ results: [], paging: { pageIndex: 1, pageSize: 2, total: 0 } }); - wrapper.find('InputSearch').prop('onChange')('blabla'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('blabla'); - expect(loadSearchResultCount).not.toHaveBeenCalled(); - - // search fails - onSearch.mockRejectedValue(undefined); - wrapper.find('InputSearch').prop('onChange')('blabla'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); // should render previous results - expect(onSearch).toHaveBeenLastCalledWith('blabla'); - expect(loadSearchResultCount).not.toHaveBeenCalled(); -}); - -it('should limit the number of items', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 5 }); - expect(wrapper.find('FacetItem').length).toBe(2); - - wrapper.find('ListStyleFacetFooter').prop('showMore')(); - wrapper.update(); - expect(wrapper.find('FacetItem').length).toBe(3); - - wrapper.find('ListStyleFacetFooter').prop('showLess')(); - wrapper.update(); - expect(wrapper.find('FacetItem').length).toBe(2); -}); - -it('should show warning that there might be more results', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 3 }); - wrapper.find('ListStyleFacetFooter').prop('showMore')(); - wrapper.update(); - expect(wrapper.find('FlagMessage').exists()).toBe(true); -}); - -// eslint-disable-next-line jest/expect-expect -it('should reset state when closes', () => { - const wrapper = shallowRender(); - - wrapper.setState({ - query: 'foobar', - searchResults: ['foo', 'bar'], - searching: true, - showFullList: true, - }); - - wrapper.setProps({ open: false }); - checkInitialState(wrapper); -}); - -// eslint-disable-next-line jest/expect-expect -it('should reset search when query changes', () => { - const wrapper = shallowRender({ query: { a: ['foo'] } }); - wrapper.setState({ query: 'foo', searchResults: ['foo'], searchResultsCounts: { foo: 3 } }); - wrapper.setProps({ query: { a: ['foo'], b: ['bar'] } }); - checkInitialState(wrapper); -}); - -it('should collapse list when new stats have few results', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 3 }); - wrapper.setState({ showFullList: true }); - - wrapper.setProps({ stats: { d: 1 } }); - expect(wrapper.state('showFullList')).toBe(false); -}); - -it('should display all selected items', () => { - const wrapper = shallowRender({ - maxInitialItems: 2, - stats: { a: 10, b: 5, c: 3 }, - values: ['a', 'b', 'c'], - }); - - expect(wrapper).toMatchSnapshot(); -}); - -it('should be disabled', () => { - const wrapper = shallowRender({ disabled: true }); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial> = {}) { - return shallow( - , - ); -} - -function checkInitialState(wrapper: ShallowWrapper) { - expect(wrapper.state('query')).toBe(''); - expect(wrapper.state('searchResults')).toBeUndefined(); - expect(wrapper.state('searching')).toBe(false); - expect(wrapper.state('searchResultsCounts')).toEqual({}); - expect(wrapper.state('showFullList')).toBe(false); -} diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap deleted file mode 100644 index 4b2f846624e..00000000000 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap +++ /dev/null @@ -1,480 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should be disabled 1`] = ` - -`; - -exports[`should display all selected items 1`] = ` - - - - - - - -
    - ⋯ -
    - - - - - -
    -
    -`; - -exports[`should render 1`] = ` - - - - - - - - - - - - -`; - -exports[`should search 1`] = ` - - - - - - - - - - - -`; - -exports[`should search 2`] = ` - - - - - - - - - - - - -`; - -exports[`should search 3`] = ` - - - - - - - - - - - - -`; - -exports[`should search 4`] = ` - - - -
    - no_results -
    - -
    -
    -`; - -exports[`should search 5`] = ` - - - -
    - no_results -
    - -
    -
    -`; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx index cf51ccf8c44..ebef45448cb 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx @@ -298,7 +298,7 @@ it('should be able to compare profiles', async () => { await selectEvent.select(ui.compareDropdown.get(), 'java quality profile #2'); expect(ui.comparisonDiffTableHeading(1, 'java quality profile').get()).toBeInTheDocument(); expect(ui.comparisonDiffTableHeading(1, 'java quality profile #2').get()).toBeInTheDocument(); - expect(ui.comparisonModifiedTableHeading(1).query()).toBeInTheDocument(); + expect(ui.comparisonModifiedTableHeading(1).get()).toBeInTheDocument(); // java quality profile is not editable expect(ui.activeRuleButton('java quality profile').query()).not.toBeInTheDocument(); diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx deleted file mode 100644 index 3497e9a8f30..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx +++ /dev/null @@ -1,86 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockBranch } from '../../../helpers/mocks/branch-like'; -import { mockSourceLine } from '../../../helpers/mocks/sources'; -import { mockIssue } from '../../../helpers/testMocks'; -import { MetricKey } from '../../../types/metrics'; -import Line from '../components/Line'; -import SourceViewerCode from '../SourceViewerCode'; - -it('should correctly flag a line for scrolling', () => { - const sources = [ - mockSourceLine({ line: 1, coverageStatus: 'covered', isNew: false }), - mockSourceLine({ line: 2, coverageStatus: 'partially-covered', isNew: false }), - mockSourceLine({ line: 3, coverageStatus: 'uncovered', isNew: true }), - ]; - let wrapper = shallowRender({ sources, metricKey: MetricKey.uncovered_lines }); - - expect(wrapper.find(Line).at(1).props().scrollToUncoveredLine).toBe(true); - expect(wrapper.find(Line).at(2).props().scrollToUncoveredLine).toBe(false); - - wrapper = shallowRender({ - sources, - metricKey: MetricKey.new_uncovered_lines, - }); - - expect(wrapper.find(Line).at(1).props().scrollToUncoveredLine).toBe(false); - expect(wrapper.find(Line).at(2).props().scrollToUncoveredLine).toBe(true); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx deleted file mode 100644 index 62a97ff3b6a..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockBranch } from '../../../../helpers/mocks/branch-like'; -import { mockSourceLine } from '../../../../helpers/mocks/sources'; -import { mockIssue } from '../../../../helpers/testMocks'; -import LineIssuesList, { LineIssuesListProps } from '../LineIssuesList'; - -it('should render issues', () => { - const wrapper = shallowRender({ - selectedIssue: 'issue', - issueLocationsByLine: { '1': [{ from: 1, to: 1, line: 1 }] }, - line: mockSourceLine({ line: 1 }), - issuesForLine: [mockIssue(false, { key: 'issue' })], - }); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx deleted file mode 100644 index fb355868c66..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx +++ /dev/null @@ -1,182 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockBranch } from '../../../../helpers/mocks/branch-like'; -import { click, waitAndUpdate } from '../../../../helpers/testUtils'; -import { ComponentQualifier } from '../../../../types/component'; -import { MetricKey } from '../../../../types/metrics'; -import { SourceViewerFile } from '../../../../types/types'; -import MeasuresOverlay from '../MeasuresOverlay'; - -jest.mock('../../../../api/issues', () => ({ - getFacets: () => - Promise.resolve({ - facets: [ - { - property: 'types', - values: [ - { val: 'CODE_SMELL', count: 2 }, - { val: 'BUG', count: 1 }, - { val: 'VULNERABILITY', count: 0 }, - ], - }, - { - property: 'severities', - values: [ - { val: 'MAJOR', count: 1 }, - { val: 'INFO', count: 2 }, - { val: 'MINOR', count: 3 }, - { val: 'CRITICAL', count: 4 }, - { val: 'BLOCKER', count: 5 }, - ], - }, - { - property: 'tags', - values: [ - { val: 'bad-practice', count: 1 }, - { val: 'cert', count: 3 }, - { val: 'design', count: 1 }, - ], - }, - ], - }), -})); - -jest.mock('../../../../api/measures', () => ({ - getMeasures: () => - Promise.resolve([ - { metric: MetricKey.vulnerabilities, value: '0' }, - { metric: MetricKey.complexity, value: '1' }, - { metric: MetricKey.test_errors, value: '1' }, - { metric: MetricKey.comment_lines_density, value: '20.0' }, - { metric: MetricKey.wont_fix_issues, value: '0' }, - { metric: MetricKey.uncovered_lines, value: '1' }, - { metric: MetricKey.functions, value: '1' }, - { metric: MetricKey.duplicated_files, value: '1' }, - { metric: MetricKey.duplicated_blocks, value: '3' }, - { metric: MetricKey.line_coverage, value: '75.0' }, - { metric: MetricKey.duplicated_lines_density, value: '0.0' }, - { metric: MetricKey.comment_lines, value: '2' }, - { metric: MetricKey.ncloc, value: '8' }, - { metric: MetricKey.reliability_rating, value: '1.0' }, - { metric: MetricKey.false_positive_issues, value: '0' }, - { metric: MetricKey.reliability_remediation_effort, value: '0' }, - { metric: MetricKey.code_smells, value: '2' }, - { metric: MetricKey.security_rating, value: '1.0' }, - { metric: MetricKey.test_success_density, value: '100.0' }, - { metric: MetricKey.cognitive_complexity, value: '0' }, - { metric: MetricKey.files, value: '1' }, - { metric: MetricKey.duplicated_lines, value: '0' }, - { metric: MetricKey.lines, value: '18' }, - { metric: MetricKey.classes, value: '1' }, - { metric: MetricKey.bugs, value: '0' }, - { metric: MetricKey.lines_to_cover, value: '4' }, - { metric: MetricKey.sqale_index, value: '40' }, - { metric: MetricKey.sqale_debt_ratio, value: '16.7' }, - { metric: MetricKey.coverage, value: '75.0' }, - { metric: MetricKey.security_remediation_effort, value: '0' }, - { metric: MetricKey.statements, value: '3' }, - { metric: MetricKey.skipped_tests, value: '0' }, - { metric: MetricKey.test_failures, value: '0' }, - { metric: MetricKey.violations, value: '1' }, - ]), -})); - -jest.mock('../../../../api/metrics', () => ({ - getAllMetrics: () => - Promise.resolve([ - { key: MetricKey.vulnerabilities, type: 'INT', domain: 'Security' }, - { key: MetricKey.complexity, type: 'INT', domain: 'Complexity' }, - { key: MetricKey.test_errors, type: 'INT', domain: 'Tests' }, - { key: MetricKey.comment_lines_density, type: 'PERCENT', domain: 'Size' }, - { key: MetricKey.wont_fix_issues, type: 'INT', domain: 'Issues' }, - { key: MetricKey.uncovered_lines, type: 'INT', domain: 'Coverage' }, - { key: MetricKey.functions, type: 'INT', domain: 'Size' }, - { key: MetricKey.duplicated_files, type: 'INT', domain: 'Duplications' }, - { key: MetricKey.duplicated_blocks, type: 'INT', domain: 'Duplications' }, - { key: MetricKey.line_coverage, type: 'PERCENT', domain: 'Coverage' }, - { key: MetricKey.duplicated_lines_density, type: 'PERCENT', domain: 'Duplications' }, - { key: MetricKey.comment_lines, type: 'INT', domain: 'Size' }, - { key: MetricKey.ncloc, type: 'INT', domain: 'Size' }, - { key: MetricKey.reliability_rating, type: 'RATING', domain: 'Reliability' }, - { key: MetricKey.false_positive_issues, type: 'INT', domain: 'Issues' }, - { key: MetricKey.code_smells, type: 'INT', domain: 'Maintainability' }, - { key: MetricKey.security_rating, type: 'RATING', domain: 'Security' }, - { key: MetricKey.test_success_density, type: 'PERCENT', domain: 'Tests' }, - { key: MetricKey.cognitive_complexity, type: 'INT', domain: 'Complexity' }, - { key: MetricKey.files, type: 'INT', domain: 'Size' }, - { key: MetricKey.duplicated_lines, type: 'INT', domain: 'Duplications' }, - { key: MetricKey.lines, type: 'INT', domain: 'Size' }, - { key: MetricKey.classes, type: 'INT', domain: 'Size' }, - { key: MetricKey.bugs, type: 'INT', domain: 'Reliability' }, - { key: MetricKey.lines_to_cover, type: 'INT', domain: 'Coverage' }, - { key: MetricKey.sqale_index, type: 'WORK_DUR', domain: 'Maintainability' }, - { key: MetricKey.sqale_debt_ratio, type: 'PERCENT', domain: 'Maintainability' }, - { key: MetricKey.coverage, type: 'PERCENT', domain: 'Coverage' }, - { key: MetricKey.statements, type: 'INT', domain: 'Size' }, - { key: MetricKey.skipped_tests, type: 'INT', domain: 'Tests' }, - { key: MetricKey.test_failures, type: 'INT', domain: 'Tests' }, - { key: MetricKey.violations, type: 'INT', domain: 'Issues' }, - // next two must be filtered out - { key: 'data', type: 'DATA' }, - { key: 'hidden', hidden: true }, - ]), -})); - -const sourceViewerFile: SourceViewerFile = { - key: 'component-key', - measures: {}, - path: 'src/file.js', - project: 'project-key', - projectName: 'Project Name', - q: ComponentQualifier.File, - uuid: 'abcd123', -}; - -const branchLike = mockBranch({ name: 'feature' }); - -it('should render source file', async () => { - const wrapper = shallowRender(); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - - click(wrapper.find('.js-show-all-measures')); - expect(wrapper).toMatchSnapshot(); -}); - -it('should render test file', async () => { - const wrapper = shallowRender({ - sourceViewerFile: { ...sourceViewerFile, q: ComponentQualifier.TestFile }, - }); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx deleted file mode 100644 index 8e11917aadf..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import MeasuresOverlayMeasure from '../MeasuresOverlayMeasure'; - -it('should render', () => { - expect( - shallow( - , - ), - ).toMatchSnapshot(); -}); - -it('should render issues icon', () => { - expect( - shallow( - , - ), - ).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap deleted file mode 100644 index 4f776d6e497..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap +++ /dev/null @@ -1,65 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render issues 1`] = ` -
    - -
    -`; diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap deleted file mode 100644 index e0330d87479..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap +++ /dev/null @@ -1,1849 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render source file 1`] = ` - -
    -

    - component_viewer.file_measures -

    -
    -
    -
    -
    - - - Project Name - -
    -
    - - src/file.js -
    -
    -
    -
    -
    -
    - - - - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    - - - - - violations - -
    -
    - - - - - sqale_index - -
    -
    -
    -
    - - - issue.type.BUG - - - 1 - -
    -
    - - - issue.type.VULNERABILITY - - - 0 - -
    -
    - - - issue.type.CODE_SMELL - - - 2 - -
    -
    -
    -
    - - - - - 5 - -
    -
    - - - - - 4 - -
    -
    - - - - - 1 - -
    -
    - - - - - 3 - -
    -
    - - - - - 2 - -
    -
    -
    -
    - - - bad-practice - - - 1 - -
    -
    - - - cert - - - 3 - -
    -
    - - - design - - - 1 - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - - - - - coverage - -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    - -
    -
    - - - - - duplicated_lines_density - -
    -
    -
    - - -
    -
    -
    -
    - -
    -
    - - close - -
    -
    -`; - -exports[`should render source file 2`] = ` - -
    -

    - component_viewer.file_measures -

    -
    -
    -
    -
    - - - Project Name - -
    -
    - - src/file.js -
    -
    -
    -
    -
    -
    - - - - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    - - - - - violations - -
    -
    - - - - - sqale_index - -
    -
    -
    -
    - - - issue.type.BUG - - - 1 - -
    -
    - - - issue.type.VULNERABILITY - - - 0 - -
    -
    - - - issue.type.CODE_SMELL - - - 2 - -
    -
    -
    -
    - - - - - 5 - -
    -
    - - - - - 4 - -
    -
    - - - - - 1 - -
    -
    - - - - - 3 - -
    -
    - - - - - 2 - -
    -
    -
    -
    - - - bad-practice - - - 1 - -
    -
    - - - cert - - - 3 - -
    -
    - - - design - - - 1 - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - - - - - coverage - -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    - -
    -
    - - - - - duplicated_lines_density - -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - metric_domain.Complexity - -
    - - -
    -
    -
    -
    -
    - - metric_domain.Size - -
    - - - - - - - - -
    -
    -
    -
    -
    - - metric_domain.Coverage - -
    - - - - -
    -
    -
    -
    -
    - - metric_domain.Reliability - -
    - - -
    -
    -
    -
    -
    -
    -
    - - metric_domain.Security - -
    - - -
    -
    -
    -
    -
    - - metric_domain.Tests - -
    - - - - -
    -
    -
    -
    -
    - - metric_domain.Issues - -
    - - - -
    -
    -
    -
    -
    - - metric_domain.Duplications - -
    - - - - -
    -
    -
    -
    -
    - - metric_domain.Maintainability - -
    - - - -
    -
    -
    -
    -
    -
    -
    - - close - -
    -
    -`; - -exports[`should render test file 1`] = ` - -
    -

    - component_viewer.file_measures -

    -
    -
    -
    -
    - - - Project Name - -
    -
    - - src/file.js -
    -
    -
    -
    -
    -
    - - - - -
    -
    -
    -
    - -
    -
    - - close - -
    -
    -`; diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayMeasure-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayMeasure-test.tsx.snap deleted file mode 100644 index 4612ee4034a..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayMeasure-test.tsx.snap +++ /dev/null @@ -1,53 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` -
    - - Coverage - - - - -
    -`; - -exports[`should render issues icon 1`] = ` -
    - - - Bugs - - - - -
    -`; diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/A11yLinks-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11yLinks-test.tsx new file mode 100644 index 00000000000..94fff12982b --- /dev/null +++ b/server/sonar-web/src/main/js/components/a11y/__tests__/A11yLinks-test.tsx @@ -0,0 +1,93 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import userEvent from '@testing-library/user-event'; +import * as React from 'react'; +import { renderComponent } from '../../../helpers/testReactTestingUtils'; +import { byRole } from '../../../helpers/testSelector'; +import { A11yContext } from '../A11yContext'; +import A11yProvider from '../A11yProvider'; +import A11ySkipLinks from '../A11ySkipLinks'; + +const ui = { + links: byRole('link'), + + // specific to test + addButton: byRole('button', { name: 'Add' }), + removeButton: byRole('button', { name: 'Remove' }), +}; + +it('should render correctly', async () => { + const user = userEvent.setup(); + + renderA11ySkipLinks(); + + expect(ui.links.queryAll()).toHaveLength(0); + + await user.click(ui.addButton.get()); + expect(ui.links.getAll()).toHaveLength(1); + + await user.click(ui.addButton.get()); + expect(ui.links.getAll()).toHaveLength(2); + + await user.click(ui.removeButton.get()); + expect(ui.links.getAll()).toHaveLength(1); +}); + +function renderA11ySkipLinks() { + return renderComponent( + + + + + , + '/', + {}, + ); +} + +let count = 0; + +function LinkTester() { + const { addA11ySkipLink, removeA11ySkipLink } = React.useContext(A11yContext); + + return ( + <> + + + + ); +} diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/A11yProvider-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11yProvider-test.tsx deleted file mode 100644 index d90fac4b41a..00000000000 --- a/server/sonar-web/src/main/js/components/a11y/__tests__/A11yProvider-test.tsx +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { waitAndUpdate } from '../../../helpers/testUtils'; -import { A11yContextShape } from '../A11yContext'; -import A11yProvider from '../A11yProvider'; - -const link1 = { key: 'link1', label: 'Link 1', weight: 0 }; -const link2 = { key: 'link2', label: 'Link 2', weight: -10 }; -const link3 = { key: 'link3', label: 'Link 3', weight: 0 }; - -it('should allow to register new skip links', () => { - const wrapper = shallowRender(); - const instance = wrapper.instance(); - expect(wrapper.state('links')).toEqual([]); - - // Check that an absence of weight is treated as "0". - instance.addA11ySkipLink({ ...link1, weight: undefined }); - expect(wrapper.state('links')).toEqual([link1]); - - instance.addA11ySkipLink(link2); - expect(wrapper.state('links')).toEqual([link1, link2]); -}); - -it('should pass the ordered links to the consumers', () => { - const wrapper = shallowRender(); - const instance = wrapper.instance(); - instance.setState({ links: [link1, link2, link3] }); - waitAndUpdate(wrapper); - expect((wrapper.prop('value') as A11yContextShape).links).toEqual([link2, link1, link3]); -}); - -it('should allow to unregister skip links', () => { - const wrapper = shallowRender(); - const instance = wrapper.instance(); - instance.setState({ links: [link1, link2, link3] }); - - instance.removeA11ySkipLink(link1); - expect(wrapper.state('links')).toEqual([link2, link3]); - - instance.removeA11ySkipLink(link2); - expect(wrapper.state('links')).toEqual([link3]); -}); - -function shallowRender() { - return shallow( - -
    - , - ); -} diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx deleted file mode 100644 index 83c1d74f918..00000000000 --- a/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import A11ySkipLinks from '../A11ySkipLinks'; - -jest.mock('../A11yContext', () => ({ - A11yContext: { - Consumer: ({ children }: any) => { - return children({ - links: [ - { key: 'link1', label: 'Label 1' }, - { key: 'link2', label: 'Label 2' }, - ], - }); - }, - }, -})); - -it('should render correctly', () => { - expect(shallow().dive()).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipTarget-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipTarget-test.tsx deleted file mode 100644 index 4aebc7f17fb..00000000000 --- a/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipTarget-test.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { mount } from 'enzyme'; -import * as React from 'react'; -import { A11ySkipTargetInner } from '../A11ySkipTarget'; - -it('should render correctly, and (un)register the link when (un)mounted', () => { - const link = { key: 'main', label: 'Skip to content' }; - const addA11ySkipLink = jest.fn(); - const removeA11ySkipLink = jest.fn(); - const wrapper = mount( - , - ); - - expect(wrapper).toMatchSnapshot(); - expect(addA11ySkipLink).toHaveBeenCalledWith(link); - wrapper.unmount(); - expect(removeA11ySkipLink).toHaveBeenCalledWith(link); -}); diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap b/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap deleted file mode 100644 index 2918cc6adf2..00000000000 --- a/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap +++ /dev/null @@ -1,20 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -[ - - Label 1 - , - - Label 2 - , -] -`; diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap b/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap deleted file mode 100644 index 5b6fbdc757b..00000000000 --- a/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap +++ /dev/null @@ -1,32 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly, and (un)register the link when (un)mounted 1`] = ` - - - -`; diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx deleted file mode 100644 index 83b5bc2a22d..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import BarChart from '../BarChart'; - -it('should display bars', () => { - const data = [ - { x: 1, y: 10, description: '' }, - { x: 2, y: 30, description: '' }, - { x: 3, y: 20, description: '' }, - ]; - const chart = shallow(); - expect(chart.find('.bar-chart-bar').length).toBe(3); -}); - -it('should display ticks', () => { - const data = [ - { x: 1, y: 10, description: '' }, - { x: 2, y: 30, description: '' }, - { x: 3, y: 20, description: '' }, - ]; - const ticks = ['A', 'B', 'C']; - const chart = shallow( - , - ); - expect(chart.find('.bar-chart-tick').length).toBe(3); -}); - -it('should display values', () => { - const data = [ - { x: 1, y: 10, description: '' }, - { x: 2, y: 30, description: '' }, - { x: 3, y: 20, description: '' }, - ]; - const values = ['A', 'B', 'C']; - const chart = shallow( - , - ); - expect(chart.find('.bar-chart-tick').length).toBe(3); -}); - -it('should display bars, ticks and values', () => { - const data = [ - { x: 1, y: 10, description: '' }, - { x: 2, y: 30, description: '' }, - { x: 3, y: 20, description: '' }, - ]; - const ticks = ['A', 'B', 'C']; - const values = ['A', 'B', 'C']; - const chart = shallow( - , - ); - expect(chart.find('.bar-chart-bar').length).toBe(3); - expect(chart.find('.bar-chart-tick').length).toBe(6); -}); diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx deleted file mode 100644 index d31efbc5099..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { scaleLinear } from 'd3-scale'; -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { colors } from '../../../app/theme'; -import ColorGradientLegend from '../ColorGradientLegend'; - -const COLORS = [colors.green, colors.lightGreen, colors.yellow, colors.orange, colors.red]; - -it('should render properly', () => { - const colorScale = scaleLinear().domain([0, 25, 50, 75, 100]).range(COLORS); - const wrapper = shallow( - , - ); - expect(wrapper).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx deleted file mode 100644 index f5351a2edfe..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import DonutChart, { DonutChartProps } from '../DonutChart'; - -it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); - expect(wrapper.find('Sector').first().dive()).toMatchSnapshot(); -}); - -it('should render correctly with padding and pad angle too', () => { - expect(shallowRender({ padAngle: 0.1, padding: [2, 2, 2, 2] })).toMatchSnapshot(); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx deleted file mode 100644 index 70942003c34..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import LineChart from '../LineChart'; - -it('should display line', () => { - const data = [ - { x: 1, y: 10 }, - { x: 2, y: 30 }, - { x: 3, y: 20 }, - ]; - const chart = shallow(); - expect(chart.find('.line-chart-path').length).toBe(1); -}); - -it('should display ticks', () => { - const data = [ - { x: 1, y: 10 }, - { x: 2, y: 30 }, - { x: 3, y: 20 }, - ]; - const ticks = ['A', 'B', 'C']; - const chart = shallow(); - expect(chart.find('.line-chart-tick').length).toBe(3); -}); - -it('should display values', () => { - const data = [ - { x: 1, y: 10 }, - { x: 2, y: 30 }, - { x: 3, y: 20 }, - ]; - const values = ['A', 'B', 'C']; - const chart = shallow(); - expect(chart.find('.line-chart-tick').length).toBe(3); -}); diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/ColorGradientLegend-test.tsx.snap b/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/ColorGradientLegend-test.tsx.snap deleted file mode 100644 index f57804837fd..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/ColorGradientLegend-test.tsx.snap +++ /dev/null @@ -1,220 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render properly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - 25 - - - 50 - - - 75 - - - 100 - - - - - - N/A - - - -`; diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/DonutChart-test.tsx.snap b/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/DonutChart-test.tsx.snap deleted file mode 100644 index f85bb20e41e..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/DonutChart-test.tsx.snap +++ /dev/null @@ -1,122 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - - - - - - - - -`; - -exports[`should render correctly 2`] = ` - -`; - -exports[`should render correctly with padding and pad angle too 1`] = ` - - - - - - - - -`; diff --git a/server/sonar-web/src/main/js/components/common/DocumentationLink.tsx b/server/sonar-web/src/main/js/components/common/DocumentationLink.tsx deleted file mode 100644 index ae066847439..00000000000 --- a/server/sonar-web/src/main/js/components/common/DocumentationLink.tsx +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { Link, LinkProps } from 'design-system'; -import * as React from 'react'; -import { useDocUrl } from '../../helpers/docs'; - -type Props = Omit & { to: string; innerRef?: React.Ref }; - -export default function DocumentationLink({ to, innerRef, ...props }: Props) { - const toStatic = useDocUrl(to); - return ; -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/CodeSnippet-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/CodeSnippet-test.tsx deleted file mode 100644 index d8d9f98db7e..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/CodeSnippet-test.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import CodeSnippet, { CodeSnippetProps } from '../CodeSnippet'; - -beforeEach(jest.clearAllMocks); - -it('renders correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({ noCopy: true })).toMatchSnapshot('no copy'); - expect(shallowRender({ snippet: ['foo', 'bar'] })).toMatchSnapshot('array snippet'); - expect(shallowRender({ isOneLine: true, snippet: ['foo', 'bar'] })).toMatchSnapshot( - 'single line with array snippet', - ); -}); - -function shallowRender(props: Partial = {}) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx deleted file mode 100644 index 100f8379354..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import DisableableSelectOption, { DisableableSelectOptionProps } from '../DisableableSelectOption'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({ option: { value: 'baz' } })).toMatchSnapshot('no label'); - expect( - shallowRender({ option: { label: 'Bar', value: 'bar', isDisabled: true } }), - ).toMatchSnapshot('disabled'); - expect( - shallowRender({ - option: { label: 'Bar', value: 'bar', isDisabled: true }, - disabledReason: 'bar baz', - }), - ).toMatchSnapshot('disabled, with explanation'); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - 'foo bar'} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/InstanceMessage-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/InstanceMessage-test.tsx deleted file mode 100644 index b223dc80b15..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/InstanceMessage-test.tsx +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { getInstance } from '../../../helpers/system'; -import InstanceMessage from '../InstanceMessage'; - -jest.mock('../../../helpers/system', () => ({ getInstance: jest.fn() })); - -it('should replace {instance} with "SonarQube"', () => { - const childFunc = jest.fn(); - shallowRender(childFunc, 'foo {instance} bar'); - expect(childFunc).toHaveBeenCalledWith('foo SonarQube bar'); -}); - -it('should replace {instance} with "SonarCloud"', () => { - const childFunc = jest.fn(); - shallowRender(childFunc, 'foo {instance} bar', true); - expect(childFunc).toHaveBeenCalledWith('foo SonarCloud bar'); -}); - -it('should return the same message', () => { - const childFunc = jest.fn(); - shallowRender(childFunc, 'no instance to replace'); - expect(childFunc).toHaveBeenCalledWith('no instance to replace'); -}); - -function shallowRender( - children: (msg: string) => React.ReactChild, - message: string, - onSonarCloud = false, -) { - (getInstance as jest.Mock).mockImplementation(() => (onSonarCloud ? 'SonarCloud' : 'SonarQube')); - return shallow({children}); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/MeasuresLink-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/MeasuresLink-test.tsx deleted file mode 100644 index 5365faa7256..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/MeasuresLink-test.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockMainBranch } from '../../../helpers/mocks/branch-like'; -import MeasuresLink, { MeasuresLinkProps } from '../MeasuresLink'; - -it('renders', () => { - expect(shallowRender()).toMatchSnapshot(); - expect(shallowRender({ label: 'Foo' })).toMatchSnapshot(); - expect(shallowRender({ branchLike: mockMainBranch() })).toMatchSnapshot(); -}); - -function shallowRender(props: Partial = {}) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/PageCounter-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/PageCounter-test.tsx deleted file mode 100644 index 69275013760..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/PageCounter-test.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import PageCounter, { PageCounterProps } from '../PageCounter'; - -it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx deleted file mode 100644 index 914e7b3f512..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { ComponentQualifier, Visibility } from '../../../types/component'; -import PrivacyBadge from '../PrivacyBadgeContainer'; - -it('renders', () => { - expect(getWrapper()).toMatchSnapshot(); -}); - -it('should render public', () => { - expect(getWrapper({ visibility: Visibility.Public })).toMatchSnapshot(); -}); - -function getWrapper(props = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/ProjectKeyInput-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/ProjectKeyInput-test.tsx deleted file mode 100644 index 456fd04a47d..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/ProjectKeyInput-test.tsx +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import ValidationInput from '../../../components/controls/ValidationInput'; -import ProjectKeyInput, { ProjectKeyInputProps } from '../ProjectKeyInput'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({ projectKey: 'foo' })).toMatchSnapshot('with value'); - expect( - shallowRender({ help: 'foo.help', label: 'foo.label', placeholder: 'foo.placeholder' }), - ).toMatchSnapshot('with label, help, and placeholder'); - expect(shallowRender({ touched: true })).toMatchSnapshot('valid'); - expect(shallowRender({ touched: true, error: 'bar.baz' })).toMatchSnapshot('invalid'); - expect(shallowRender({ touched: true, validating: true })).toMatchSnapshot('validating'); - expect(shallowRender({ autofocus: true })).toMatchSnapshot('autofocus'); -}); - -it('should not display any status when the key is not defined', () => { - const wrapper = shallowRender(); - const input = wrapper.find(ValidationInput); - expect(input.props().isInvalid).toBe(false); - expect(input.props().isValid).toBe(false); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx deleted file mode 100644 index 8e86f5a1d4a..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx +++ /dev/null @@ -1,109 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { changePassword } from '../../../api/users'; -import { mockLoggedInUser } from '../../../helpers/testMocks'; -import { mockEvent, waitAndUpdate } from '../../../helpers/testUtils'; -import { ChangePasswordResults } from '../../../types/users'; -import { Alert } from '../../ui/Alert'; -import ResetPasswordForm from '../ResetPasswordForm'; - -jest.mock('../../../api/users', () => ({ - changePassword: jest.fn().mockResolvedValue({}), -})); - -beforeEach(() => { - jest.clearAllMocks(); -}); - -it('should trigger on password change prop', () => { - const onPasswordChange = jest.fn(); - const wrapper = shallowRender({ onPasswordChange }); - wrapper.instance().handleSuccessfulChange(); - expect(onPasswordChange).not.toHaveBeenCalled(); - wrapper.instance().oldPassword = { value: '' } as HTMLInputElement; - wrapper.instance().password = { value: '' } as HTMLInputElement; - wrapper.instance().passwordConfirmation = { value: '' } as HTMLInputElement; - wrapper.instance().handleSuccessfulChange(); - expect(onPasswordChange).toHaveBeenCalled(); -}); - -it('should not trigger password change', () => { - const wrapper = shallowRender(); - wrapper.instance().oldPassword = { value: 'testold' } as HTMLInputElement; - wrapper.instance().password = { value: 'test', focus: () => {} } as HTMLInputElement; - wrapper.instance().passwordConfirmation = { value: 'test1' } as HTMLInputElement; - wrapper.instance().handleChangePassword(mockEvent()); - expect(changePassword).not.toHaveBeenCalled(); - expect(wrapper.state().errors).toBeDefined(); -}); - -it('should not change password if new password is same as old', async () => { - jest.mocked(changePassword).mockRejectedValueOnce(ChangePasswordResults.NewPasswordSameAsOld); - - const wrapper = shallowRender(); - wrapper.instance().oldPassword = { value: 'testold' } as HTMLInputElement; - wrapper.instance().password = { value: 'test', focus: () => {} } as HTMLInputElement; - wrapper.instance().passwordConfirmation = { value: 'test' } as HTMLInputElement; - wrapper.instance().handleChangePassword(mockEvent()); - await waitAndUpdate(wrapper); - expect(wrapper.find(Alert)).toMatchSnapshot(); -}); - -it('should not change password if old password is incorrect', async () => { - jest.mocked(changePassword).mockRejectedValueOnce(ChangePasswordResults.OldPasswordIncorrect); - - const wrapper = shallowRender(); - wrapper.instance().oldPassword = { value: 'testold' } as HTMLInputElement; - wrapper.instance().password = { value: 'test', focus: () => {} } as HTMLInputElement; - wrapper.instance().passwordConfirmation = { value: 'test' } as HTMLInputElement; - wrapper.instance().handleChangePassword(mockEvent()); - await waitAndUpdate(wrapper); - expect(wrapper.find(Alert)).toMatchSnapshot(); -}); - -it('should trigger password change', async () => { - const user = mockLoggedInUser(); - const wrapper = shallowRender({ user }); - wrapper.instance().handleChangePassword(mockEvent()); - await waitAndUpdate(wrapper); - expect(changePassword).not.toHaveBeenCalled(); - - wrapper.instance().oldPassword = { value: 'testold' } as HTMLInputElement; - wrapper.instance().password = { value: 'test' } as HTMLInputElement; - wrapper.instance().passwordConfirmation = { value: 'test' } as HTMLInputElement; - wrapper.instance().handleChangePassword(mockEvent()); - await waitAndUpdate(wrapper); - - expect(changePassword).toHaveBeenCalledWith({ - login: user.login, - password: 'test', - previousPassword: 'testold', - }); -}); - -it('renders correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -function shallowRender(props?: Partial) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/RestartButton-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/RestartButton-test.tsx deleted file mode 100644 index e0d0c513630..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/RestartButton-test.tsx +++ /dev/null @@ -1,30 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import RestartButton from '../RestartButton'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -function shallowRender(props: Partial = {}) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/SatusIndicator-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/SatusIndicator-test.tsx deleted file mode 100644 index e17fc5d92ce..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/SatusIndicator-test.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import StatusIndicator, { StatusIndicatorProps } from '../StatusIndicator'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({ color: 'green' })).toMatchSnapshot('green'); - expect(shallowRender({ size: 'small' })).toMatchSnapshot('small'); - expect(shallowRender({ size: 'big' })).toMatchSnapshot('big'); -}); - -function shallowRender(props: Partial = {}) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/CodeSnippet-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/CodeSnippet-test.tsx.snap deleted file mode 100644 index 86f625595c1..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/CodeSnippet-test.tsx.snap +++ /dev/null @@ -1,67 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders correctly: array snippet 1`] = ` -
    -
    -    foo \\
    -  bar
    -  
    - -
    -`; - -exports[`renders correctly: default 1`] = ` -
    -
    -    foo
    -bar
    -  
    - -
    -`; - -exports[`renders correctly: no copy 1`] = ` -
    -
    -    foo
    -bar
    -  
    -
    -`; - -exports[`renders correctly: single line with array snippet 1`] = ` -
    -
    -    foo bar
    -  
    - -
    -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/DisableableSelectOption-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/DisableableSelectOption-test.tsx.snap deleted file mode 100644 index 5ed0c2ae05a..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/DisableableSelectOption-test.tsx.snap +++ /dev/null @@ -1,42 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: default 1`] = ` - - Foo - -`; - -exports[`should render correctly: disabled 1`] = ` - - - Bar - - -`; - -exports[`should render correctly: disabled, with explanation 1`] = ` - - - Bar - - ( - bar baz - ) - - - -`; - -exports[`should render correctly: no label 1`] = ` - - baz - -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MeasuresLink-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MeasuresLink-test.tsx.snap deleted file mode 100644 index 80ac25cbe87..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MeasuresLink-test.tsx.snap +++ /dev/null @@ -1,61 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders 1`] = ` - - - - portfolio.measures_link - - -`; - -exports[`renders 2`] = ` - - - - Foo - - -`; - -exports[`renders 3`] = ` - - - - portfolio.measures_link - - -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PageCounter-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PageCounter-test.tsx.snap deleted file mode 100644 index a36f29997fd..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PageCounter-test.tsx.snap +++ /dev/null @@ -1,17 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -
    - - 124 / - - 1,234 - - - label -
    -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap deleted file mode 100644 index 4bbe4a4a09a..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap +++ /dev/null @@ -1,25 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders 1`] = ` - -
    - visibility.private -
    -
    -`; - -exports[`should render public 1`] = ` - -
    - visibility.public -
    -
    -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ProjectKeyInput-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ProjectKeyInput-test.tsx.snap deleted file mode 100644 index d8e65b043ed..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ProjectKeyInput-test.tsx.snap +++ /dev/null @@ -1,154 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: autofocus 1`] = ` - - - -`; - -exports[`should render correctly: default 1`] = ` - - - -`; - -exports[`should render correctly: invalid 1`] = ` - - - -`; - -exports[`should render correctly: valid 1`] = ` - - - -`; - -exports[`should render correctly: validating 1`] = ` - - - -`; - -exports[`should render correctly: with label, help, and placeholder 1`] = ` - - - -`; - -exports[`should render correctly: with value 1`] = ` - - - -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ResetPasswordForm-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ResetPasswordForm-test.tsx.snap deleted file mode 100644 index 120f08f447f..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ResetPasswordForm-test.tsx.snap +++ /dev/null @@ -1,89 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders correctly 1`] = ` -
    - -
    - - -
    -
    - - -
    -
    - - -
    -
    - - update_verb - -
    - -`; - -exports[`should not change password if new password is same as old 1`] = ` - - user.new_password_same_as_old - -`; - -exports[`should not change password if old password is incorrect 1`] = ` - - user.old_password_incorrect - -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/RestartButton-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/RestartButton-test.tsx.snap deleted file mode 100644 index 4d612a7bcff..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/RestartButton-test.tsx.snap +++ /dev/null @@ -1,28 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - -

    - system.are_you_sure_to_restart -

    -

    - system.forcing_shutdown_not_recommended -

    -

    - system.restart_does_not_reload_sonar_properties -

    - - } - modalHeader="system.restart_server" - onConfirm={[Function]} -> - -
    -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/SatusIndicator-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/SatusIndicator-test.tsx.snap deleted file mode 100644 index e2fc7608203..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/SatusIndicator-test.tsx.snap +++ /dev/null @@ -1,34 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: big 1`] = ` - - - -`; - -exports[`should render correctly: default 1`] = ` - - - -`; - -exports[`should render correctly: green 1`] = ` - - system.current_health.green - - -`; - -exports[`should render correctly: small 1`] = ` - - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx deleted file mode 100644 index d72ae50bf91..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx +++ /dev/null @@ -1,85 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import { PopupPlacement } from '../../ui/popups'; -import ActionsDropdown, { - ActionsDropdownDivider, - ActionsDropdownItem, - ActionsDropdownProps, -} from '../ActionsDropdown'; -import { ButtonPlain } from '../buttons'; - -describe('ActionsDropdown', () => { - it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); - expect(shallowRender({ small: false })).toMatchSnapshot(); - }); - - function shallowRender(props: Partial = {}) { - return shallow( - - Hello world - , - ); - } -}); - -describe('ActionsDropdownItem', () => { - it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); - expect(shallowRender({ destructive: true, id: 'baz', to: 'path/name' })).toMatchSnapshot(); - expect(shallowRender({ download: 'foo/bar', to: 'path/name' })).toMatchSnapshot(); - }); - - it('should trigger click', () => { - const onClick = jest.fn(); - const wrapper = shallowRender({ onClick }); - - click(wrapper.find(ButtonPlain)); - expect(onClick).toHaveBeenCalled(); - }); - - function shallowRender(props: Partial = {}) { - return shallow(renderContent(props)); - } - - function renderContent(props: Partial = {}) { - return ( - - Hello world - - ); - } -}); - -describe('ActionsDropdownDivider', () => { - it('should render correctly', () => { - expect(shallow()).toMatchSnapshot(); - }); -}); diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/BackButton-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/BackButton-test.tsx deleted file mode 100644 index 56e7b3dd7c4..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/BackButton-test.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import BackButton from '../BackButton'; - -it('should render properly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); -}); - -it('should handle click', () => { - const onClick = jest.fn(); - const wrapper = shallowRender({ onClick }); - expect(wrapper).toMatchSnapshot(); - click(wrapper.find('a')); - expect(onClick).toHaveBeenCalled(); -}); - -function shallowRender(props: Partial = {}) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx deleted file mode 100644 index ecb9d46f15a..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { mount, shallow } from 'enzyme'; -import * as React from 'react'; -import BoxedTabs, { BoxedTabsProps } from '../BoxedTabs'; - -it('should render correctly', () => { - expect(mountRender()).toMatchSnapshot(); -}); - -it('should call onSelect when a tab is clicked', () => { - const onSelect = jest.fn(); - const wrapper = shallowRender({ onSelect }); - - wrapper.find('Styled(button)').get(1).props.onClick(); - - expect(onSelect).toHaveBeenCalledWith('b'); -}); - -function shallowRender(overrides: Partial> = {}) { - return shallow(dom(overrides)); -} - -function mountRender(overrides: Partial> = {}) { - return mount(dom(overrides)); -} - -function dom(overrides: Partial>) { - return ( - - Complex label !!! - - ), - }, - ]} - {...overrides} - /> - ); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ClickEventBoundary-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ClickEventBoundary-test.tsx deleted file mode 100644 index 9ecb24b98a5..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ClickEventBoundary-test.tsx +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { mount } from 'enzyme'; -import * as React from 'react'; -import ClickEventBoundary from '../ClickEventBoundary'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should correctly capture a click event', () => { - const parentOnClick = jest.fn(); - const childOnClick = jest.fn(); - const wrapper = shallowRender({ onClick: parentOnClick }, { onClick: childOnClick }); - // Don't use our click() helper, so we make sure the bubbling works correctly. - wrapper.find('button').simulate('click'); - expect(childOnClick).toHaveBeenCalled(); - expect(parentOnClick).not.toHaveBeenCalled(); -}); - -function shallowRender(parentProps = {}, childProps = {}) { - // We need to mount in order to support event bubbling. - return mount( -
    - - - -
    , - ); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/DateInput-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/DateInput-test.tsx deleted file mode 100644 index a2d1a96be4c..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/DateInput-test.tsx +++ /dev/null @@ -1,101 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { addDays, subDays } from 'date-fns'; -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { DayPicker } from 'react-day-picker'; -import { parseDate } from '../../../helpers/dates'; -import DateInput from '../DateInput'; - -beforeAll(() => { - Date.prototype.getFullYear = jest.fn().mockReturnValue(2018); // eslint-disable-line no-extend-native -}); - -const dateA = parseDate('2018-01-17T00:00:00.000Z'); -const dateB = parseDate('2018-02-05T00:00:00.000Z'); - -it('should render', () => { - const { wrapper } = shallowRender(); - - expect(wrapper).toMatchSnapshot(); - - wrapper.setProps({ value: dateA }); - expect(wrapper).toMatchSnapshot(); - - wrapper.setState({ open: true }); - expect(wrapper).toMatchSnapshot(); -}); - -it('should select a day', () => { - const onChange = jest.fn(); - const { wrapper, instance } = shallowRender({ onChange }); - wrapper.setState({ open: true }); - - instance.handleDayClick(dateA, { disabled: true }); - expect(onChange).not.toHaveBeenCalled(); - expect(wrapper.state().open).toBe(true); - - instance.handleDayClick(dateA, {}); - expect(onChange).toHaveBeenLastCalledWith(dateA); - wrapper.update(); - expect(wrapper.state().open).toBe(false); - expect(wrapper).toMatchSnapshot(); - - instance.handleResetClick(); - expect(onChange).toHaveBeenLastCalledWith(undefined); -}); - -it('should hightlightFrom range', () => { - const { wrapper, instance } = shallowRender({ highlightFrom: dateA }); - wrapper.setState({ open: true }); - - const dateC = addDays(dateA, 3); - instance.handleDayMouseEnter(dateC, {}); - wrapper.update(); - const dayPicker = wrapper.find(DayPicker); - expect(dayPicker.props().modifiers).toEqual({ highlighted: { from: dateA, to: dateC } }); -}); - -it('should hightlightTo range', () => { - const { wrapper, instance } = shallowRender({ highlightTo: dateB }); - wrapper.setState({ open: true }); - - const dateC = subDays(dateB, 5); - instance.handleDayMouseEnter(dateC, {}); - wrapper.update(); - const dayPicker = wrapper.find(DayPicker); - expect(dayPicker.props().modifiers).toEqual({ highlighted: { from: dateC, to: dateB } }); -}); - -function shallowRender(props?: Partial) { - const wrapper = shallow( - , - ); - const instance = wrapper.instance(); - return { wrapper, instance }; -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/DateRangeInput-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/DateRangeInput-test.tsx deleted file mode 100644 index 160a01fdcae..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/DateRangeInput-test.tsx +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { parseDate } from '../../../helpers/dates'; -import DateRangeInput from '../DateRangeInput'; - -const dateA = parseDate('2018-01-17T00:00:00.000Z'); -const dateB = parseDate('2018-02-05T00:00:00.000Z'); - -it('should render', () => { - expect( - shallow(), - ).toMatchSnapshot(); - - expect( - shallow(), - ).toMatchSnapshot('with min/max'); - - expect( - shallow( - , - ), - ).toMatchSnapshot('with min/max and value'); -}); - -it('should change', () => { - const onChange = jest.fn(); - const wrapper = shallow(); - - wrapper.find('DateInput[data-test="from"]').prop('onChange')(dateA); - expect(onChange).toHaveBeenLastCalledWith({ from: dateA, to: undefined }); - wrapper.setProps({ value: { from: dateA } }); - - wrapper.find('DateInput[data-test="to"]').prop('onChange')(dateB); - wrapper.update(); - expect(onChange).toHaveBeenLastCalledWith({ from: dateA, to: dateB }); -}); diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Dropdown-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Dropdown-test.tsx deleted file mode 100644 index d8fc4295858..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/Dropdown-test.tsx +++ /dev/null @@ -1,113 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -/* eslint-disable jest/expect-expect */ - -import { mount, shallow, ShallowWrapper } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import { Popup, PopupPlacement } from '../../ui/popups'; -import { Button } from '../buttons'; -import Dropdown, { DropdownOverlay } from '../Dropdown'; -import ScreenPositionFixer from '../ScreenPositionFixer'; - -describe('Dropdown', () => { - it('renders', () => { - expect( - shallow(}>{() =>
    }) - .find('div') - .exists(), - ).toBe(true); - }); - - it('toggles with element child', () => { - checkToggle( - shallow( - }> - - -`; - -exports[`ActionsDropdown should render correctly 2`] = ` - - - Hello world - - - } - overlayPlacement="bottom" -> - - -`; - -exports[`ActionsDropdownDivider should render correctly 1`] = ` -
  • -`; - -exports[`ActionsDropdownItem should render correctly 1`] = ` -
  • - - - Hello world - - -
  • -`; - -exports[`ActionsDropdownItem should render correctly 2`] = ` -
  • - - - Hello world - - -
  • -`; - -exports[`ActionsDropdownItem should render correctly 3`] = ` -
  • - - - Hello world - - -
  • -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap deleted file mode 100644 index 5d932f59cc1..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap +++ /dev/null @@ -1,49 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should handle click 1`] = ` - - - - - - - -`; - -exports[`should render properly 1`] = ` - - - - - - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BoxedTabs-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BoxedTabs-test.tsx.snap deleted file mode 100644 index 804db4b4d9b..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BoxedTabs-test.tsx.snap +++ /dev/null @@ -1,1368 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -.emotion-0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-flex-direction: row; - -ms-flex-direction: row; - flex-direction: row; -} - -.emotion-1 { - position: relative; - background-color: white; - border-top: 1px solid #e6e6e6; - border-left: 1px solid #e6e6e6; - border-right: none; - border-bottom: none; - margin-bottom: -1px; - min-width: 128px; - min-height: 56px; - outline: 0; - padding: calc(2 * 8px); -} - -.emotion-1:last-child { - border-right: 1px solid #e6e6e6; -} - -.emotion-2 { - display: block; - background-color: #4b9fd5; - height: 3px; - width: 100%; - position: absolute; - left: 0; - top: -1px; -} - -.emotion-3 { - position: relative; - background-color: #f3f3f3; - border-top: 1px solid #e6e6e6; - border-left: 1px solid #e6e6e6; - border-right: none; - border-bottom: none; - margin-bottom: -1px; - min-width: 128px; - min-height: 56px; - cursor: pointer; - outline: 0; - padding: calc(2 * 8px); -} - -.emotion-3:hover { - background-color: #f8f8f8; -} - -.emotion-3:last-child { - border-right: 1px solid #e6e6e6; -} - -.emotion-4 { - display: none; - background-color: #4b9fd5; - height: 3px; - width: 100%; - position: absolute; - left: 0; - top: -1px; -} - - - Complex label - - !!! - - , - }, - ] - } -> - - - - - - - - - - - , - "ctr": 8, - "insertionPoint": undefined, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "prepend": undefined, - "tags": [ - , - , - , - , - , - , - , - , - ], - }, - } - } - isStringTag={true} - serialized={ - { - "map": undefined, - "name": "o2j9ze", - "next": undefined, - "styles": " - display: flex; - flex-direction: row; -", - "toString": [Function], - } - } - /> -
    - - - - - - - - - - - , - "ctr": 8, - "insertionPoint": undefined, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "prepend": undefined, - "tags": [ - , - , - , - , - , - , - , - , - ], - }, - } - } - isStringTag={true} - serialized={ - { - "map": undefined, - "name": "60rv5s", - "next": undefined, - "styles": " - position: relative; - background-color: white; - border-top: 1px solid #e6e6e6; - border-left: 1px solid #e6e6e6; - border-right: none; - border-bottom: none; - margin-bottom: -1px; - min-width: 128px; - min-height: 56px; - - outline: 0; - padding: calc(2 * 8px); - - - - &:last-child { - border-right: 1px solid #e6e6e6; - } -", - "toString": [Function], - } - } - /> - - - - - - - - - - - - - , - "ctr": 8, - "insertionPoint": undefined, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "prepend": undefined, - "tags": [ - , - , - , - , - , - , - , - , - ], - }, - } - } - isStringTag={true} - serialized={ - { - "map": undefined, - "name": "1kg7pv0", - "next": undefined, - "styles": " - position: relative; - background-color: #f3f3f3; - border-top: 1px solid #e6e6e6; - border-left: 1px solid #e6e6e6; - border-right: none; - border-bottom: none; - margin-bottom: -1px; - min-width: 128px; - min-height: 56px; - cursor: pointer; - outline: 0; - padding: calc(2 * 8px); - - - &:hover { - background-color: #f8f8f8; - } - - - &:last-child { - border-right: 1px solid #e6e6e6; - } -", - "toString": [Function], - } - } - /> - - - - - - - - - - - - - , - "ctr": 8, - "insertionPoint": undefined, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "prepend": undefined, - "tags": [ - , - , - , - , - , - , - , - , - ], - }, - } - } - isStringTag={true} - serialized={ - { - "map": undefined, - "name": "1kg7pv0", - "next": undefined, - "styles": " - position: relative; - background-color: #f3f3f3; - border-top: 1px solid #e6e6e6; - border-left: 1px solid #e6e6e6; - border-right: none; - border-bottom: none; - margin-bottom: -1px; - min-width: 128px; - min-height: 56px; - cursor: pointer; - outline: 0; - padding: calc(2 * 8px); - - - &:hover { - background-color: #f8f8f8; - } - - - &:last-child { - border-right: 1px solid #e6e6e6; - } -", - "toString": [Function], - } - } - /> - - -
    -
    -
    -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ClickEventBoundary-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ClickEventBoundary-test.tsx.snap deleted file mode 100644 index 62eac278e7f..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ClickEventBoundary-test.tsx.snap +++ /dev/null @@ -1,14 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -
    - - - -
    -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateInput-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateInput-test.tsx.snap deleted file mode 100644 index 655dd56b03a..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateInput-test.tsx.snap +++ /dev/null @@ -1,184 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` - - - - - - - - - - -`; - -exports[`should render 2`] = ` - - - - - - - - - - - -`; - -exports[`should render 3`] = ` - - - - - - - -
    - -
    -
    -
    -
    -
    -`; - -exports[`should select a day 1`] = ` - - - - - - - - - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateRangeInput-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateRangeInput-test.tsx.snap deleted file mode 100644 index 19e4e6ab487..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateRangeInput-test.tsx.snap +++ /dev/null @@ -1,155 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` -
    -
    - - -
    - - to_ - -
    - - -
    -
    -`; - -exports[`should render: with min/max 1`] = ` -
    -
    - - -
    - - to_ - -
    - - -
    -
    -`; - -exports[`should render: with min/max and value 1`] = ` -
    -
    - - -
    - - to_ - -
    - - -
    -
    -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/HelpTooltip-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/HelpTooltip-test.tsx.snap deleted file mode 100644 index f57bb80bd3a..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/HelpTooltip-test.tsx.snap +++ /dev/null @@ -1,49 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render dark helptooltip properly: dark 1`] = ` - - } -> - - -`; - -exports[`should render properly: default 1`] = ` -
    - - } - > - - - } - fill="#888" - role="img" - size={12} - /> - - -
    -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/IdentityProviderLink-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/IdentityProviderLink-test.tsx.snap deleted file mode 100644 index c6a28b370f1..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/IdentityProviderLink-test.tsx.snap +++ /dev/null @@ -1,21 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - - Foo - Link text - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/InputValidationField-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/InputValidationField-test.tsx.snap deleted file mode 100644 index 16f3e1c2dfa..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/InputValidationField-test.tsx.snap +++ /dev/null @@ -1,13 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ModalValidationField-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ModalValidationField-test.tsx.snap deleted file mode 100644 index cc15270b4b8..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ModalValidationField-test.tsx.snap +++ /dev/null @@ -1,71 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should display the field as valid 1`] = ` -
    - - - -
    -`; - -exports[`should display the field with an error 1`] = ` -
    - - - -

    - Is required -

    -
    -`; - -exports[`should display the field without any error/validation 1`] = ` -
    - - -
    - Describe Foo. -
    -
    -`; - -exports[`should display the field without any error/validation 2`] = ` -
    - - -
    -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Radio-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Radio-test.tsx.snap deleted file mode 100644 index 8649fba79b8..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Radio-test.tsx.snap +++ /dev/null @@ -1,29 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render properly: checked 1`] = ` - - - -`; - -exports[`should render properly: not checked 1`] = ` - - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/RadioCard-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/RadioCard-test.tsx.snap deleted file mode 100644 index eedf38615d1..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/RadioCard-test.tsx.snap +++ /dev/null @@ -1,173 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should be actionable 1`] = ` -
    -

    - - - Radio Card - -

    -
    -
    - content -
    -
    -
    -`; - -exports[`should be actionable 2`] = ` -
    -

    - - - Radio Card - - info -

    -
    -
    - content -
    -
    -
    -`; - -exports[`should render correctly 1`] = ` -
    -

    - - Radio Card - - info -

    -
    -
    - content -
    -
    -
    - - - recommended - , - } - } - /> -
    -
    -`; - -exports[`should render correctly 2`] = ` -
    -

    - - Radio Card Vertical - - info -

    -
    -
    - content -
    -
    -
    - - - recommended - , - } - } - /> -
    -
    -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ReloadButton-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ReloadButton-test.tsx.snap deleted file mode 100644 index f94c6cfc6f2..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ReloadButton-test.tsx.snap +++ /dev/null @@ -1,47 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should handle click 1`] = ` - - - - - - - -`; - -exports[`should render properly 1`] = ` - - - - - - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap deleted file mode 100644 index ce284960f01..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap +++ /dev/null @@ -1,41 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders 1`] = ` -
    - - - - - - -
    -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Select-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Select-test.tsx.snap deleted file mode 100644 index 0136a28365e..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Select-test.tsx.snap +++ /dev/null @@ -1,2325 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Select should render clearIndicator correctly 1`] = ` -
    - -
    -`; - -exports[`Select should render complex select component: other props 1`] = ` - -`; - -exports[`Select should render correctly: default 1`] = ` - -`; - -exports[`Select should render dropdownIndicator correctly 1`] = ``; - -exports[`Select should render loadingIndicator correctly 1`] = ` - -`; - -exports[`Select should render multiValueRemove correctly 1`] = ` - - × - -`; - -exports[`should render CreatableSelect correctly 1`] = ` - - - - - - Select... - - - - - - - - - -`; - -exports[`should render SearchSelect correctly 1`] = ` - - - - - - Select... - - - - - - - - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap deleted file mode 100644 index 49b14a9e20f..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap +++ /dev/null @@ -1,52 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders 1`] = ` - -
    - -`; - -exports[`submits 1`] = ` - - - -`; - -exports[`submits 2`] = ` - - - -`; - -exports[`submits 3`] = ` - - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Toggle-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Toggle-test.tsx.snap deleted file mode 100644 index ac7aa845377..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Toggle-test.tsx.snap +++ /dev/null @@ -1,58 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: disabled 1`] = ` - -`; - -exports[`should render correctly: off 1`] = ` - -`; - -exports[`should render correctly: on 1`] = ` - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap deleted file mode 100644 index 6cbc3a5b5c8..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap +++ /dev/null @@ -1,62 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should not render empty tooltips 1`] = ` -
    -`; - -exports[`should not render empty tooltips 2`] = ` -
    -`; - -exports[`should render 1`] = ` - -
    - - - - -`; - -exports[`should render 2`] = ` - -
    - - - - - - - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationForm-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationForm-test.tsx.snap deleted file mode 100644 index 2958fbb81f8..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationForm-test.tsx.snap +++ /dev/null @@ -1,16 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render and submit 1`] = ` - - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap deleted file mode 100644 index 32dd5f73936..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap +++ /dev/null @@ -1,162 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: default 1`] = ` -
    - -
    -
    - -
    -
    - My description -
    -
    -`; - -exports[`should render correctly: error under the input 1`] = ` -
    - -
    -
    -
    - - - Field error message - -
    -
    -
    - My description -
    -
    -`; - -exports[`should render correctly: no label 1`] = ` -
    -
    -
    - -
    -
    - My description -
    -
    -`; - -exports[`should render correctly: with error 1`] = ` -
    - -
    -
    - - - Field error message - -
    -
    -
    - My description -
    -
    -
    -`; - -exports[`should render correctly: with help 1`] = ` -
    - -
    -
    -
    -
    - My description -
    -
    -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationModal-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationModal-test.tsx.snap deleted file mode 100644 index ee17dc8e5ce..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationModal-test.tsx.snap +++ /dev/null @@ -1,114 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - - - - - -`; - -exports[`should render correctly 2`] = ` - -
    -
    -

    - title -

    -
    -
    - -
    -
    - - - confirm - - - cancel - -
    -
    -
    -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/buttons-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/buttons-test.tsx.snap deleted file mode 100644 index ba0ff5c2f59..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/buttons-test.tsx.snap +++ /dev/null @@ -1,31 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Button should render correctly 1`] = ` - -`; - -exports[`ButtonIcon should render correctly 1`] = ` - - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/buttons-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/buttons-test.tsx deleted file mode 100644 index f42c2055934..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/buttons-test.tsx +++ /dev/null @@ -1,77 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { click, mockEvent } from '../../../helpers/testUtils'; -import { Button, ButtonIcon, ButtonIconProps } from '../buttons'; - -describe('Button', () => { - it('should render correctly', () => { - const onClick = jest.fn(); - const preventDefault = jest.fn(); - const stopPropagation = jest.fn(); - const wrapper = shallowRender({ onClick }); - expect(wrapper).toMatchSnapshot(); - click(wrapper.find('button'), mockEvent({ preventDefault, stopPropagation })); - expect(onClick).toHaveBeenCalled(); - expect(preventDefault).toHaveBeenCalled(); - expect(stopPropagation).not.toHaveBeenCalled(); - }); - - it('should not stop propagation, but prevent default of the click event', () => { - const preventDefault = jest.fn(); - const stopPropagation = jest.fn(); - const wrapper = shallowRender({ preventDefault: false, stopPropagation: true }); - click(wrapper.find('button'), mockEvent({ preventDefault, stopPropagation })); - expect(preventDefault).not.toHaveBeenCalled(); - expect(stopPropagation).toHaveBeenCalled(); - }); - - it('should disable buttons with a class', () => { - const preventDefault = jest.fn(); - const onClick = jest.fn(); - const button = shallowRender({ disabled: true, onClick, preventDefault: false }).find('button'); - expect(button.props().disabled).toBe(true); - expect(button.props().className).toContain('disabled'); - expect(button.props()['aria-disabled']).toBe(true); - click(button, mockEvent({ preventDefault })); - expect(onClick).not.toHaveBeenCalled(); - expect(preventDefault).toHaveBeenCalled(); - }); - - function shallowRender(props: Partial = {}) { - return shallow); - } -}); - -describe('ButtonIcon', () => { - it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); - }); - - function shallowRender(props: Partial = {}) { - return shallow( - - - , - ); - } -}); diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx b/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx deleted file mode 100644 index 6a40051be8e..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx +++ /dev/null @@ -1,221 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow, ShallowWrapper } from 'enzyme'; -import * as React from 'react'; -import { waitAndUpdate } from '../../../helpers/testUtils'; -import ListStyleFacet, { Props } from '../ListStyleFacet'; - -it('should render', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should select items', () => { - const onChange = jest.fn(); - const wrapper = shallowRender({ onChange }); - const instance = wrapper.instance() as ListStyleFacet; - - // select one item - instance.handleItemClick('b', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b'] }); - wrapper.setProps({ values: ['b'] }); - - // select another item - instance.handleItemClick('a', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['a'] }); - wrapper.setProps({ values: ['a'] }); - - // unselect item - instance.handleItemClick('a', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: [] }); - wrapper.setProps({ values: [] }); - - // select multiple items - wrapper.setProps({ values: ['b'] }); - instance.handleItemClick('c', true); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b', 'c'] }); - wrapper.setProps({ values: ['b', 'c'] }); - - // unselect item - instance.handleItemClick('c', true); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b'] }); -}); - -it('should toggle', () => { - const onToggle = jest.fn(); - const wrapper = shallowRender({ onToggle }); - wrapper.find('FacetHeader').prop('onClick')(); - expect(onToggle).toHaveBeenCalled(); -}); - -it('should clear', () => { - const onChange = jest.fn(); - const wrapper = shallowRender({ onChange, values: ['a'] }); - wrapper.find('FacetHeader').prop('onClear')(); - expect(onChange).toHaveBeenCalledWith({ foo: [] }); -}); - -it('should search', async () => { - const onSearch = jest.fn().mockResolvedValue({ - results: ['d', 'e'], - paging: { pageIndex: 1, pageSize: 2, total: 3 }, - }); - const loadSearchResultCount = jest.fn().mockResolvedValue({ d: 7, e: 3 }); - const wrapper = shallowRender({ loadSearchResultCount, onSearch }); - - // search - wrapper.find('SearchBox').prop('onChange')('query'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('query'); - expect(loadSearchResultCount).toHaveBeenLastCalledWith(['d', 'e']); - - // load more results - onSearch.mockResolvedValue({ - results: ['f'], - paging: { pageIndex: 2, pageSize: 2, total: 3 }, - }); - loadSearchResultCount.mockResolvedValue({ f: 5 }); - wrapper.find('ListFooter').prop('loadMore')(); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('query', 2); - - // clear search - onSearch.mockClear(); - loadSearchResultCount.mockClear(); - wrapper.find('SearchBox').prop('onChange')(''); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).not.toHaveBeenCalled(); - expect(loadSearchResultCount).not.toHaveBeenCalled(); - - // search for no results - onSearch.mockResolvedValue({ results: [], paging: { pageIndex: 1, pageSize: 2, total: 0 } }); - wrapper.find('SearchBox').prop('onChange')('blabla'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('blabla'); - expect(loadSearchResultCount).not.toHaveBeenCalled(); - - // search fails - onSearch.mockRejectedValue(undefined); - wrapper.find('SearchBox').prop('onChange')('blabla'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); // should render previous results - expect(onSearch).toHaveBeenLastCalledWith('blabla'); - expect(loadSearchResultCount).not.toHaveBeenCalled(); -}); - -it('should limit the number of items', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 5 }); - expect(wrapper.find('FacetItem').length).toBe(2); - - wrapper.find('ListStyleFacetFooter').prop('showMore')(); - wrapper.update(); - expect(wrapper.find('FacetItem').length).toBe(3); - - wrapper.find('ListStyleFacetFooter').prop('showLess')(); - wrapper.update(); - expect(wrapper.find('FacetItem').length).toBe(2); -}); - -it('should show warning that there might be more results', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 3 }); - wrapper.find('ListStyleFacetFooter').prop('showMore')(); - wrapper.update(); - expect(wrapper.find('Alert').exists()).toBe(true); -}); - -it('should reset state when closes', () => { - const wrapper = shallowRender(); - wrapper.setState({ - query: 'foobar', - searchResults: ['foo', 'bar'], - searching: true, - showFullList: true, - }); - - wrapper.setProps({ open: false }); - checkInitialState(wrapper); -}); - -it('should reset search when query changes', () => { - const wrapper = shallowRender({ query: { a: ['foo'] } }); - wrapper.setState({ query: 'foo', searchResults: ['foo'], searchResultsCounts: { foo: 3 } }); - wrapper.setProps({ query: { a: ['foo'], b: ['bar'] } }); - checkInitialState(wrapper); -}); - -it('should collapse list when new stats have few results', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 3 }); - wrapper.setState({ showFullList: true }); - - wrapper.setProps({ stats: { d: 1 } }); - expect(wrapper.state('showFullList')).toBe(false); -}); - -it('should display all selected items', () => { - const wrapper = shallowRender({ - maxInitialItems: 2, - stats: { a: 10, b: 5, c: 3 }, - values: ['a', 'b', 'c'], - }); - expect(wrapper).toMatchSnapshot(); -}); - -it('should be disabled', () => { - const wrapper = shallowRender({ disabled: true, disabledHelper: 'Disabled helper description' }); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial> = {}) { - return shallow( - , - ); -} - -function identity(str: string) { - return str; -} - -function checkInitialState(wrapper: ShallowWrapper) { - expect(wrapper.state('query')).toBe(''); - expect(wrapper.state('searchResults')).toBeUndefined(); - expect(wrapper.state('searching')).toBe(false); - expect(wrapper.state('searchResultsCounts')).toEqual({}); - expect(wrapper.state('showFullList')).toBe(false); -} diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacetFooter-test.tsx b/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacetFooter-test.tsx deleted file mode 100644 index e69cb0ef2ec..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacetFooter-test.tsx +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import { ButtonLink } from '../../controls/buttons'; -import ListStyleFacetFooter from '../ListStyleFacetFooter'; - -it('should not render "show more"', () => { - expect( - shallow(), - ).toMatchSnapshot(); -}); - -it('should show more', () => { - const showMore = jest.fn(); - const wrapper = shallow( - , - ); - expect(wrapper).toMatchSnapshot(); - click(wrapper.find(ButtonLink)); - expect(showMore).toHaveBeenCalled(); -}); - -it('should show less', () => { - const showLess = jest.fn(); - const wrapper = shallow( - , - ); - expect(wrapper).toMatchSnapshot(); - click(wrapper.find(ButtonLink)); - expect(showLess).toHaveBeenCalled(); -}); - -it('should not render "show less"', () => { - const wrapper = shallow( - , - ); - expect(wrapper).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx b/server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx deleted file mode 100644 index 326d54d2a28..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import MultipleSelectionHint from '../MultipleSelectionHint'; - -it('should render for mac', () => { - Object.defineProperty(navigator, 'userAgent', { - configurable: true, - value: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4)', - }); - expect(shallow()).toMatchSnapshot(); -}); - -it('should render for windows', () => { - Object.defineProperty(navigator, 'userAgent', { - configurable: true, - value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)', - }); - expect(shallow()).toMatchSnapshot(); -}); - -it('should not render when there is not selection', () => { - expect(shallow().type()).toBeNull(); -}); - -it('should not render when there are not enough options', () => { - expect(shallow().type()).toBeNull(); -}); diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap b/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap deleted file mode 100644 index 9d47ddf8963..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap +++ /dev/null @@ -1,436 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should be disabled 1`] = ` - - - -`; - -exports[`should display all selected items 1`] = ` - - - - - - - -
    - ⋯ -
    - - - - - -
    -`; - -exports[`should render 1`] = ` - - - - - - - - - - - -`; - -exports[`should search 1`] = ` - - - - - - - - - - -`; - -exports[`should search 2`] = ` - - - - - - - - - - - -`; - -exports[`should search 3`] = ` - - - - - - - - - - - -`; - -exports[`should search 4`] = ` - - - -
    - no_results -
    - -
    -`; - -exports[`should search 5`] = ` - - - -
    - no_results -
    - -
    -`; diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacetFooter-test.tsx.snap b/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacetFooter-test.tsx.snap deleted file mode 100644 index c699c8c828d..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacetFooter-test.tsx.snap +++ /dev/null @@ -1,45 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should not render "show less" 1`] = ` -
    - x_show.15 -
    -`; - -exports[`should not render "show more" 1`] = ` -
    - x_show.3 -
    -`; - -exports[`should show less 1`] = ` -
    - x_show.15 - - show_less - -
    -`; - -exports[`should show more 1`] = ` -
    - x_show.3 - - show_more - -
    -`; diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/MultipleSelectionHint-test.tsx.snap b/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/MultipleSelectionHint-test.tsx.snap deleted file mode 100644 index 247cc9d51e4..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/MultipleSelectionHint-test.tsx.snap +++ /dev/null @@ -1,25 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render for mac 1`] = ` -
    -
    - shortcuts.section.global.facets.multiselection.mac -
    -
    -`; - -exports[`should render for windows 1`] = ` -
    -
    - shortcuts.section.global.facets.multiselection -
    -
    -`; diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/__snapshots__/withNotifications-test.tsx.snap b/server/sonar-web/src/main/js/components/hoc/__tests__/__snapshots__/withNotifications-test.tsx.snap deleted file mode 100644 index 5da7720f265..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/__snapshots__/withNotifications-test.tsx.snap +++ /dev/null @@ -1,48 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should fetch notifications and render 1`] = ` - -`; diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx deleted file mode 100644 index d5abb40e2b0..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow, ShallowWrapper } from 'enzyme'; -import * as React from 'react'; -import { CurrentUserContext } from '../../../app/components/current-user/CurrentUserContext'; -import handleRequiredAuthentication from '../../../helpers/handleRequiredAuthentication'; -import { whenLoggedIn } from '../whenLoggedIn'; - -jest.mock('../../../helpers/handleRequiredAuthentication', () => jest.fn()); - -class X extends React.Component { - render() { - return
    ; - } -} - -const UnderTest = whenLoggedIn(X); - -it('should render for logged in user', () => { - expect(getRenderedType(shallowRender())).toBe(X); -}); - -it('should not render for anonymous user', () => { - const wrapper = shallowRender(false); - expect(getRenderedType(wrapper)).toBeNull(); - expect(handleRequiredAuthentication).toHaveBeenCalled(); -}); - -function getRenderedType(wrapper: ShallowWrapper) { - return wrapper.dive().dive().dive().type(); -} - -function shallowRender(isLoggedIn = true) { - return shallow( - {}, - updateDismissedNotices: () => {}, - }} - > - - , - ); -} diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx deleted file mode 100644 index bffb4b7ee3a..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { withCLanguageFeature } from '../withCLanguageFeature'; - -jest.mock('../../../app/components/languages/LanguagesContext', () => { - return { - LanguagesContext: { - Consumer: ({ children }: { children: (props: {}) => React.ReactNode }) => { - return children({ c: { key: 'c', name: 'c' } }); - }, - }, - }; -}); - -class X extends React.Component<{ hasCLanguageFeature: boolean }> { - render() { - return
    ; - } -} - -const UnderTest = withCLanguageFeature(X); - -it('should pass if C Language feature is available', () => { - const wrapper = shallow(); - expect(wrapper.dive().type()).toBe(X); - expect(wrapper.dive().props().hasCLanguageFeature).toBe(true); -}); diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx deleted file mode 100644 index 8937df1a5b7..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import { mount } from 'enzyme'; -import * as React from 'react'; -import { IndexationContext } from '../../../app/components/indexation/IndexationContext'; -import { IndexationContextInterface } from '../../../types/indexation'; -import withIndexationContext, { WithIndexationContextProps } from '../withIndexationContext'; - -it('should render correctly', () => { - const indexationContext: IndexationContextInterface = { - status: { hasFailures: false, isCompleted: true }, - }; - - const wrapper = mountRender(indexationContext); - - expect(wrapper.find(TestComponent).props().indexationContext).toEqual(indexationContext); -}); - -function mountRender(indexationContext?: Partial) { - return mount( - - - , - ); -} - -function TestComponent(_props: WithIndexationContextProps) { - return

    TestComponent

    ; -} - -const TestComponentWithIndexationContext = withIndexationContext(TestComponent); diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx deleted file mode 100644 index 9de538471da..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx +++ /dev/null @@ -1,159 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { mount, shallow } from 'enzyme'; -import * as React from 'react'; -import { KeyboardKeys } from '../../../helpers/keycodes'; -import { mockComponent } from '../../../helpers/mocks/component'; -import { keydown } from '../../../helpers/testUtils'; -import { ComponentMeasure } from '../../../types/types'; -import withKeyboardNavigation, { WithKeyboardNavigationProps } from '../withKeyboardNavigation'; - -class X extends React.Component<{ - components?: ComponentMeasure[]; - selected?: ComponentMeasure; -}> { - render() { - return
    ; - } -} - -const WrappedComponent = withKeyboardNavigation(X); - -const COMPONENTS = [ - mockComponent({ key: 'file-1' }), - mockComponent({ key: 'file-2' }), - mockComponent({ key: 'file-3' }), -]; - -it('should wrap component correctly', () => { - const wrapper = shallow(applyProps()); - expect(wrapper.find('X').exists()).toBe(true); -}); - -it('should correctly bind key events for component navigation', () => { - const onGoToParent = jest.fn(); - const onHighlight = jest.fn((selected) => { - wrapper.setProps({ selected }); - }); - const onSelect = jest.fn(); - - const wrapper = mount( - applyProps({ - cycle: true, - onGoToParent, - onHighlight, - onSelect, - selected: COMPONENTS[1], - }), - ); - - keydown({ key: KeyboardKeys.DownArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[2]); - expect(onSelect).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.UpArrow }); - keydown({ key: KeyboardKeys.UpArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[0]); - expect(onSelect).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.UpArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[2]); - - keydown({ key: KeyboardKeys.DownArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[0]); - - keydown({ key: KeyboardKeys.RightArrow, metaKey: true }); - expect(onSelect).not.toHaveBeenCalled(); - keydown({ key: KeyboardKeys.RightArrow }); - expect(onSelect).toHaveBeenCalledWith(COMPONENTS[0]); - - keydown({ key: KeyboardKeys.Enter }); - expect(onSelect).toHaveBeenCalledWith(COMPONENTS[0]); - - keydown({ key: KeyboardKeys.LeftArrow, metaKey: true }); - expect(onGoToParent).not.toHaveBeenCalled(); - keydown({ key: KeyboardKeys.LeftArrow }); - expect(onGoToParent).toHaveBeenCalled(); -}); - -it('should support not cycling through elements, and triggering a callback on reaching the last element', () => { - const onEndOfList = jest.fn(); - const onHighlight = jest.fn((selected) => { - wrapper.setProps({ selected }); - }); - - const wrapper = mount( - applyProps({ - onEndOfList, - onHighlight, - }), - ); - - keydown({ key: KeyboardKeys.DownArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[0]); - keydown({ key: KeyboardKeys.DownArrow }); - keydown({ key: KeyboardKeys.DownArrow }); - keydown({ key: KeyboardKeys.DownArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[2]); - expect(onEndOfList).toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.UpArrow }); - keydown({ key: KeyboardKeys.UpArrow }); - keydown({ key: KeyboardKeys.UpArrow }); - keydown({ key: KeyboardKeys.UpArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[0]); -}); - -it('should correctly bind key events for codeview navigation', () => { - const onGoToParent = jest.fn(); - const onHighlight = jest.fn(); - const onSelect = jest.fn(); - - mount( - applyProps({ - isFile: true, - onGoToParent, - onHighlight, - onSelect, - selected: COMPONENTS[1], - }), - ); - - expect(onHighlight).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.DownArrow }); - expect(onHighlight).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.UpArrow }); - expect(onHighlight).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.RightArrow }); - expect(onSelect).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.Enter }); - expect(onSelect).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.LeftArrow }); - expect(onGoToParent).toHaveBeenCalled(); -}); - -function applyProps(props: Partial = {}) { - return ; -} diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx deleted file mode 100644 index 1259e1cf8fe..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx +++ /dev/null @@ -1,93 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { addNotification, getNotifications, removeNotification } from '../../../api/notifications'; -import { waitAndUpdate } from '../../../helpers/testUtils'; -import { withNotifications, WithNotificationsProps } from '../withNotifications'; - -jest.mock('../../../api/notifications', () => ({ - addNotification: jest.fn().mockResolvedValue({}), - getNotifications: jest.fn(() => - Promise.resolve({ - channels: ['channel1', 'channel2'], - globalTypes: ['type-global', 'type-common'], - notifications: [ - { - channel: 'channel1', - type: 'type-global', - project: 'foo', - projectName: 'Foo', - }, - { - channel: 'channel1', - type: 'type-common', - project: 'bar', - projectName: 'Bar', - }, - { - channel: 'channel2', - type: 'type-common', - project: 'qux', - projectName: 'Qux', - }, - ], - perProjectTypes: ['type-common'], - }), - ), - removeNotification: jest.fn().mockResolvedValue({}), -})); - -class X extends React.Component { - render() { - return
    ; - } -} - -beforeEach(() => { - jest.clearAllMocks(); -}); - -it('should fetch notifications and render', async () => { - const wrapper = shallowRender(); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(getNotifications).toHaveBeenCalled(); -}); - -it('should add and remove a notification', () => { - const wrapper = shallowRender(); - const notification = { - channel: 'EmailNotificationChannel', - project: 'foo', - type: 'SQ-MyNewIssues', - }; - - wrapper.prop('addNotification')(notification); - expect(addNotification).toHaveBeenCalledWith(notification); - - wrapper.prop('removeNotification')(notification); - expect(removeNotification).toHaveBeenCalledWith(notification); -}); - -function shallowRender() { - const UnderTest = withNotifications<{}>(X); - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/IssueIcon-test.tsx b/server/sonar-web/src/main/js/components/icons/__tests__/IssueIcon-test.tsx deleted file mode 100644 index ed08b83b29d..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/IssueIcon-test.tsx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { IssueType } from '../../../types/types'; -import IssueIcon from '../IssueIcon'; - -it('should render correctly', () => { - expect(shallowRender('BUG')).toMatchSnapshot(); - expect(shallowRender('VULNERABILITY')).toMatchSnapshot(); - expect(shallowRender('CODE_SMELL')).toMatchSnapshot(); - expect(shallowRender('SECURITY_HOTSPOT')).toMatchSnapshot(); -}); - -function shallowRender(type: IssueType) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/IssueTypeIcon-test.tsx b/server/sonar-web/src/main/js/components/icons/__tests__/IssueTypeIcon-test.tsx deleted file mode 100644 index bb836d3f8af..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/IssueTypeIcon-test.tsx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import IssueTypeIcon, { Props } from '../IssueTypeIcon'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); - expect(shallowRender({ className: 'my-class', query: 'security_hotspots' })).toMatchSnapshot(); - expect(shallowRender({ query: 'new_code_smells' })).toMatchSnapshot(); - expect(shallowRender({ query: 'vulnerability' })).toMatchSnapshot(); - expect(shallowRender({ query: 'unknown' }).type()).toBeNull(); -}); - -function shallowRender(props: Partial = {}) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/TestStatusIcon-test.tsx b/server/sonar-web/src/main/js/components/icons/__tests__/TestStatusIcon-test.tsx deleted file mode 100644 index 1d364726db8..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/TestStatusIcon-test.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import TestStatusIcon from '../TestStatusIcon'; - -it('should render correctly', () => { - expect(shallowRender('OK')).toMatchSnapshot(); - expect(shallowRender('failure')).toMatchSnapshot(); - expect(shallowRender('skipped')).toMatchSnapshot(); - expect(shallowRender('Error')).toMatchSnapshot(); -}); - -function shallowRender(status: string) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueIcon-test.tsx.snap b/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueIcon-test.tsx.snap deleted file mode 100644 index f3f5fcf1a7a..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueIcon-test.tsx.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ``; - -exports[`should render correctly 2`] = ``; - -exports[`should render correctly 3`] = ``; - -exports[`should render correctly 4`] = ``; diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueTypeIcon-test.tsx.snap b/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueTypeIcon-test.tsx.snap deleted file mode 100644 index 4373bb03f4c..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueTypeIcon-test.tsx.snap +++ /dev/null @@ -1,26 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - -`; - -exports[`should render correctly 2`] = ` - -`; - -exports[`should render correctly 3`] = ` - -`; - -exports[`should render correctly 4`] = ` - -`; diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/TestStatusIcon-test.tsx.snap b/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/TestStatusIcon-test.tsx.snap deleted file mode 100644 index 12b493c10ed..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/TestStatusIcon-test.tsx.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ``; - -exports[`should render correctly 2`] = ``; - -exports[`should render correctly 3`] = ``; - -exports[`should render correctly 4`] = ``; diff --git a/server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx b/server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx deleted file mode 100644 index fe2e5edc863..00000000000 --- a/server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx +++ /dev/null @@ -1,96 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockFlowLocation } from '../../../helpers/testMocks'; -import { click } from '../../../helpers/testUtils'; -import { FlowLocation } from '../../../types/types'; -import CrossFileLocationsNavigator from '../CrossFileLocationNavigator'; - -const location1: FlowLocation = { - component: 'foo', - componentName: 'src/foo.js', - msg: 'Do not use foo', - textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 }, -}; - -const location2: FlowLocation = { - component: 'foo', - componentName: 'src/foo.js', - msg: 'Do not use foo', - textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 5 }, -}; - -const location3: FlowLocation = { - component: 'bar', - componentName: 'src/bar.js', - msg: 'Do not use bar', - textRange: { startLine: 15, endLine: 16, startOffset: 4, endOffset: 6 }, -}; - -const location4: FlowLocation = { - component: 'bar', - componentName: 'src/bar.js', - msg: 'Do not use bar', - textRange: { startLine: 17, endLine: 18, startOffset: 7, endOffset: 9 }, -}; - -it('should render with no locations', () => { - expect(shallowRender({ locations: [] })).toMatchSnapshot(); -}); - -it('should render locations with no component name', () => { - expect(shallowRender({ locations: [mockFlowLocation({ componentName: '' })] })).toMatchSnapshot(); -}); - -it('should render', () => { - const wrapper = shallowRender(); - - expect(wrapper).toMatchSnapshot(); - expect(wrapper.find('SingleFileLocationNavigator').length).toBe(2); - - click(wrapper.find('.location-file-more')); - expect(wrapper.find('SingleFileLocationNavigator').length).toBe(4); -}); - -it('should render all locations', () => { - const wrapper = shallowRender({ locations: [location1, location2, location3] }); - - expect(wrapper.find('SingleFileLocationNavigator').length).toBe(3); -}); - -it('should expand all locations', () => { - const wrapper = shallowRender(); - expect(wrapper.find('SingleFileLocationNavigator').length).toBe(2); - - wrapper.setProps({ selectedLocationIndex: 1 }); - expect(wrapper.find('SingleFileLocationNavigator').length).toBe(4); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx b/server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx deleted file mode 100644 index 683c94949ba..00000000000 --- a/server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockIssue } from '../../../helpers/testMocks'; -import { FlowLocation } from '../../../types/types'; -import LocationsList from '../LocationsList'; - -const location1: FlowLocation = { - component: 'foo', - componentName: 'src/foo.js', - msg: 'Do not use foo', - textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 }, -}; - -const location2: FlowLocation = { - component: 'foo', - componentName: 'src/foo.js', - msg: 'Do not use foo', - textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 5 }, -}; - -it('should render locations in the same file', () => { - const locations = [location1, location2]; - expect(shallowRender({ locations })).toMatchSnapshot(); -}); - -it('should not render locations', () => { - const wrapper = shallowRender({ locations: [] }); - expect(wrapper.type()).toBeNull(); -}); - -function shallowRender(overrides: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/CrossFileLocationsNavigator-test.tsx.snap b/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/CrossFileLocationsNavigator-test.tsx.snap deleted file mode 100644 index 581e8c21603..00000000000 --- a/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/CrossFileLocationsNavigator-test.tsx.snap +++ /dev/null @@ -1,109 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` -
    -
    -
    - - src/foo.js -
    -
    - -
    -
    - -
    -
    - - src/bar.js -
    -
    - -
    -
    -
    -`; - -exports[`should render locations with no component name 1`] = ` -
    -
    -
    - -
    -
    - -
    -
    -
    -`; - -exports[`should render with no locations 1`] = ` -
    -`; diff --git a/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/LocationsList-test.tsx.snap b/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/LocationsList-test.tsx.snap deleted file mode 100644 index 8421b5c343e..00000000000 --- a/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/LocationsList-test.tsx.snap +++ /dev/null @@ -1,30 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render locations in the same file 1`] = ` -
      -
    • - -
    • -
    • - -
    • -
    -`; diff --git a/server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx b/server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx deleted file mode 100644 index c47d4ed9c21..00000000000 --- a/server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { MetricKey, MetricType } from '../../../types/metrics'; -import Measure from '../Measure'; - -it('renders trivial measure', () => { - expect( - shallow( - , - ), - ).toMatchSnapshot(); -}); - -it('renders leak measure', () => { - expect( - shallow( - , - ), - ).toMatchSnapshot(); -}); - -it('renders LEVEL', () => { - expect( - shallow( - , - ), - ).toMatchSnapshot(); -}); - -it('renders RATING', () => { - expect( - shallow( - , - ), - ).toMatchSnapshot(); -}); - -it('renders undefined measure', () => { - expect( - shallow(), - ).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx b/server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx deleted file mode 100644 index 53a0c30caea..00000000000 --- a/server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockAppState } from '../../../helpers/testMocks'; -import { GlobalSettingKeys } from '../../../types/settings'; -import { MetricKey } from '../../../types/metrics'; -import { RatingTooltipContent, RatingTooltipContentProps } from '../RatingTooltipContent'; - -it('should render maintainability correctly', () => { - expect(shallowRender()).toMatchSnapshot('sqale rating'); - expect(shallowRender({ value: 1 })).toMatchSnapshot('sqale rating A'); - expect(shallowRender({ appState: mockAppState({ settings: {} }) })).toMatchSnapshot( - 'sqale rating default grid', - ); - expect( - shallowRender({ - appState: mockAppState({ settings: { [GlobalSettingKeys.RatingGrid]: '0,0.1' } }), - }), - ).toMatchSnapshot('sqale rating wrong grid'); -}); - -it('should render other ratings correctly', () => { - expect(shallowRender({ metricKey: MetricKey.security_rating })).toMatchSnapshot( - 'security rating', - ); - expect(shallowRender({ metricKey: MetricKey.new_security_rating })).toMatchSnapshot( - 'new security rating', - ); -}); - -it('should ignore non-rating metrics', () => { - expect(shallowRender({ metricKey: MetricKey.code_smells }).type()).toBeNull(); -}); - -function shallowRender(overrides: Partial = {}) { - return shallow( - , - ); -} diff --git a/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/Measure-test.tsx.snap b/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/Measure-test.tsx.snap deleted file mode 100644 index 3a30c9bed84..00000000000 --- a/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/Measure-test.tsx.snap +++ /dev/null @@ -1,42 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders LEVEL 1`] = ` - -`; - -exports[`renders RATING 1`] = ` - - } -> - - - - -`; - -exports[`renders leak measure 1`] = ` - - 36.0% - -`; - -exports[`renders trivial measure 1`] = ` - - 73.0% - -`; - -exports[`renders undefined measure 1`] = ` - - — - -`; diff --git a/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/RatingTooltipContent-test.tsx.snap b/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/RatingTooltipContent-test.tsx.snap deleted file mode 100644 index 2ce6e0cef37..00000000000 --- a/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/RatingTooltipContent-test.tsx.snap +++ /dev/null @@ -1,37 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render maintainability correctly: sqale rating 1`] = ` - - metric.sqale_rating.tooltip.B.5.0% - -`; - -exports[`should render maintainability correctly: sqale rating A 1`] = ` - - metric.sqale_rating.tooltip.A.5.0% - -`; - -exports[`should render maintainability correctly: sqale rating default grid 1`] = ` - - metric.sqale_rating.tooltip.B.0.0% - -`; - -exports[`should render maintainability correctly: sqale rating wrong grid 1`] = ` - - metric.sqale_rating.tooltip.B.0.0% - -`; - -exports[`should render other ratings correctly: new security rating 1`] = ` - - metric.security_rating.tooltip.B - -`; - -exports[`should render other ratings correctly: security rating 1`] = ` - - metric.security_rating.tooltip.B - -`; diff --git a/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx b/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx deleted file mode 100644 index 4347ad4fc7e..00000000000 --- a/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import DrilldownLink from '../DrilldownLink'; - -it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); -}); -it('should render issuesLink correctly', () => { - const wrapper = shallowRender({ metric: 'new_violations' }); - expect(wrapper).toMatchSnapshot(); -}); - -const shallowRender = (props: Partial = {}, label = 'label') => { - return shallow( - - {label} - , - ); -}; diff --git a/server/sonar-web/src/main/js/components/shared/__tests__/__snapshots__/DrilldownLink-test.tsx.snap b/server/sonar-web/src/main/js/components/shared/__tests__/__snapshots__/DrilldownLink-test.tsx.snap deleted file mode 100644 index d6babd44056..00000000000 --- a/server/sonar-web/src/main/js/components/shared/__tests__/__snapshots__/DrilldownLink-test.tsx.snap +++ /dev/null @@ -1,28 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - - label - -`; - -exports[`should render issuesLink correctly 1`] = ` - - label - -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx deleted file mode 100644 index 55c991ab96c..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { Alert, AlertProps } from '../Alert'; - -it('should render properly', () => { - expect(shallowRender({ variant: 'error' })).toMatchSnapshot(); -}); - -it('verification of all variants of alert', () => { - const variants: AlertProps['variant'][] = ['error', 'warning', 'success', 'info', 'loading']; - variants.forEach((variant) => { - const wrapper = shallowRender({ variant }); - expect(wrapper.prop('variantInfo')).toMatchSnapshot(); - }); -}); - -it('should render inline alert', () => { - expect(shallowRender({ display: 'inline' }).find('Styled(div)[isInline=true]').exists()).toBe( - true, - ); -}); - -it('should render banner alert', () => { - expect(shallowRender({ display: 'banner' }).find('Styled(div)[isBanner=true]').exists()).toBe( - true, - ); -}); - -it('should render banner alert with correct css', () => { - expect(shallowRender({ display: 'banner' }).render()).toMatchSnapshot(); -}); - -function shallowRender(props: Partial) { - return shallow( - - This is an error! - , - ); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/AutoEllipsis-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/AutoEllipsis-test.tsx deleted file mode 100644 index c636e036ce2..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/AutoEllipsis-test.tsx +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { mount, shallow } from 'enzyme'; -import * as React from 'react'; -import AutoEllipsis, { defaultShouldEllipsis } from '../AutoEllipsis'; - -it('should render', () => { - const wrapper = shallow( - - my test text - , - ); - - expect(wrapper).toMatchSnapshot(); -}); - -it('should render with text-ellipsis class', () => { - const wrapper = mount( - true} maxWidth={5} useParent={false}> - my test text - , - ); - - expect(wrapper.find('span').hasClass('medium')).toBe(true); - expect(wrapper.find('span').hasClass('text-ellipsis')).toBe(true); -}); - -const node5 = { clientWidth: 5, clientHeight: 5 } as any; -const node10 = { clientWidth: 10, clientHeight: 10 } as any; -const nodeParentSmaller = { ...node10, parentElement: node5 }; -const nodeParentBigger = { ...node5, parentElement: node10 }; - -it('should correctly compute the auto-ellipsis', () => { - expect(defaultShouldEllipsis(node10, { maxWidth: 5, useParent: false })).toBe(true); - expect(defaultShouldEllipsis(node10, { maxHeight: 5, useParent: false })).toBe(true); - expect(defaultShouldEllipsis(node10, { maxWidth: 5, maxHeight: 5, useParent: false })).toBe(true); - expect(defaultShouldEllipsis(node10, { maxWidth: 5, maxHeight: 10, useParent: false })).toBe( - true, - ); - expect(defaultShouldEllipsis(node10, { maxWidth: 10, maxHeight: 5, useParent: false })).toBe( - true, - ); - expect(defaultShouldEllipsis(node10, { maxWidth: 10, useParent: false })).toBe(false); - expect(defaultShouldEllipsis(node10, { maxHeight: 10, useParent: false })).toBe(false); - - expect(defaultShouldEllipsis(nodeParentSmaller, { maxWidth: 10, useParent: false })).toBe(false); - expect(defaultShouldEllipsis(nodeParentSmaller, { maxHeight: 10, useParent: false })).toBe(false); -}); - -it('should correctly compute the auto-ellipsis with a parent node', () => { - expect(defaultShouldEllipsis(nodeParentSmaller, {})).toBe(true); - expect(defaultShouldEllipsis(nodeParentSmaller, { maxWidth: 10 })).toBe(true); - expect(defaultShouldEllipsis(nodeParentSmaller, { maxHeight: 10 })).toBe(true); - expect(defaultShouldEllipsis(nodeParentSmaller, { maxWidth: 10, maxHeight: 10 })).toBe(false); - expect(defaultShouldEllipsis(nodeParentBigger, {})).toBe(false); - expect(defaultShouldEllipsis(nodeParentBigger, { maxWidth: 2 })).toBe(true); - expect(defaultShouldEllipsis(nodeParentBigger, { maxHeight: 2 })).toBe(true); -}); diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx deleted file mode 100644 index 15b929b6f68..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import CoverageRating, { CoverageRatingProps } from '../CoverageRating'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should render with muted style', () => { - expect(shallowRender({ muted: true }).find('DonutChart').prop('data')).toEqual([ - { fill: '#b4b4b4', value: 25 }, - { fill: 'transparent', value: 75 }, - ]); -}); - -it('should render with small size', () => { - expect(shallowRender({ size: 'small' }).find('DonutChart').props()).toMatchObject({ - height: 20, - padAngle: 0.1, - thickness: 3, - width: 20, - }); -}); - -it('should correctly handle padAngle for 0% and 100% coverage', () => { - const wrapper = shallowRender({ value: 0 }); - expect(wrapper.find('DonutChart').prop('padAngle')).toBe(0); - - wrapper.setProps({ value: 25 }); - expect(wrapper.find('DonutChart').prop('padAngle')).toBe(0.1); - - wrapper.setProps({ value: 100 }); - expect(wrapper.find('DonutChart').prop('padAngle')).toBe(0); -}); - -function shallowRender(props: Partial = {}) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx deleted file mode 100644 index ba56087943f..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import React from 'react'; -import { ButtonIcon } from '../../../components/controls/buttons'; -import { save } from '../../../helpers/storage'; -import { click } from '../../../helpers/testUtils'; -import DismissableAlert, { - DismissableAlertProps, - DISMISSED_ALERT_STORAGE_KEY, -} from '../DismissableAlert'; - -jest.mock('../../../helpers/storage', () => ({ - get: jest.fn((_: string, suffix: string) => (suffix === 'bar' ? 'true' : undefined)), - save: jest.fn(), -})); - -jest.mock('react', () => { - return { - ...jest.requireActual('react'), - useEffect: jest.fn(), - }; -}); - -beforeEach(() => { - jest.clearAllMocks(); - (React.useEffect as jest.Mock).mockImplementationOnce((f) => f()); -}); - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should render correctly with a non-default display', () => { - expect(shallowRender({ display: 'block' })).toMatchSnapshot(); -}); - -it('should not render if it was dismissed', () => { - expect(shallowRender({ alertKey: 'bar' }).type()).toBeNull(); -}); - -it('should correctly allow dismissing', () => { - const wrapper = shallowRender(); - click(wrapper.dive().find(ButtonIcon)); - expect(save).toHaveBeenCalledWith(DISMISSED_ALERT_STORAGE_KEY, 'true', 'foo'); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - -
    My content
    -
    , - ); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/GenericAvatar-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/GenericAvatar-test.tsx deleted file mode 100644 index d6b6fe2bd07..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/GenericAvatar-test.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import GenericAvatar from '../GenericAvatar'; - -it('should render properly', () => { - expect(shallow()).toMatchSnapshot(); - expect(shallow()).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/LegacyAvatar-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/LegacyAvatar-test.tsx deleted file mode 100644 index 9c386ad5d6d..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/LegacyAvatar-test.tsx +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockAppState } from '../../../helpers/testMocks'; -import { GlobalSettingKeys } from '../../../types/settings'; -import { LegacyAvatar } from '../LegacyAvatar'; - -const gravatarServerUrl = 'http://example.com/{EMAIL_MD5}.jpg?s={SIZE}'; - -it('should be able to render with hash only', () => { - const avatar = shallow( - , - ); - expect(avatar).toMatchSnapshot(); -}); - -it('falls back to dummy avatar', () => { - const avatar = shallow( - , - ); - expect(avatar).toMatchSnapshot(); -}); - -it('do not fail when name is missing', () => { - const avatar = shallow( - , - ); - expect(avatar.getElement()).toBeNull(); -}); diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/Level-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/Level-test.tsx deleted file mode 100644 index 7cfa7d63aef..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/Level-test.tsx +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import Level, { LevelProps } from '../Level'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default ok'); - expect(shallowRender({ level: 'ERROR' })).toMatchSnapshot('default error'); - expect(shallowRender({ muted: true, small: true })).toMatchSnapshot('muted and small'); - expect(shallowRender({ 'aria-label': 'ARIA Label' })).toMatchSnapshot('with aria-label'); - expect(shallowRender({ 'aria-labelledby': 'element-id' })).toMatchSnapshot( - 'with aria-labelledby', - ); -}); - -function shallowRender(props: Partial = {}) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldMarker-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldMarker-test.tsx deleted file mode 100644 index cd9f0fa3176..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldMarker-test.tsx +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import MandatoryFieldMarker, { MandatoryFieldMarkerProps } from '../MandatoryFieldMarker'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({ className: 'foo-bar' })).toMatchSnapshot('with className'); -}); - -function shallowRender(props: Partial = {}) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/NavBar-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/NavBar-test.tsx deleted file mode 100644 index e0af00cf22f..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/NavBar-test.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import NavBar, { NavBarProps } from '../NavBar'; - -it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); -}); - -it('should render correctly with notif and not limited', () => { - const wrapper = shallowRender({ limited: false, notif:
    }); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - -
    - , - ); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/NewsBox-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/NewsBox-test.tsx deleted file mode 100644 index c8c9772618d..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/NewsBox-test.tsx +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import NewsBox, { Props } from '../NewsBox'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should call onClose', () => { - const onClose = jest.fn(); - const wrapper = shallowRender({ onClose }); - - click(wrapper.find('ClearButton')); - expect(onClose).toHaveBeenCalled(); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - -
    description
    -
    , - ); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/Rating-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/Rating-test.tsx deleted file mode 100644 index 0873c3d6233..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/Rating-test.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import Rating from '../Rating'; - -it('renders numeric value', () => { - expect(shallow()).toMatchSnapshot(); -}); - -it('renders string value', () => { - expect(shallow()).toMatchSnapshot(); -}); - -it('renders undefined value', () => { - expect(shallow()).toMatchSnapshot(); -}); - -it('renders with a custom aria-label', () => { - expect(shallow()).toMatchSnapshot(); - expect( - shallow(), - ).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/SizeRating-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/SizeRating-test.tsx deleted file mode 100644 index 5c21419223f..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/SizeRating-test.tsx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import SizeRating, { Props } from '../SizeRating'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); - expect(shallowRender({ muted: true, value: 1000 })).toMatchSnapshot(); - expect(shallowRender({ value: 10000 })).toMatchSnapshot(); - expect(shallowRender({ value: 100000 })).toMatchSnapshot(); - expect(shallowRender({ value: 500000 })).toMatchSnapshot(); -}); - -function shallowRender(props: Partial = {}) { - return shallow(); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Alert-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Alert-test.tsx.snap deleted file mode 100644 index ed55cd5b070..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Alert-test.tsx.snap +++ /dev/null @@ -1,152 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render banner alert with correct css 1`] = ` -.emotion-0 { - border: 1px solid; - border-radius: 2px; - margin-bottom: 8px; - border-color: #f4b1b0; - background-color: #f2dede; - color: #862422; - display: block; -} - -.emotion-0:empty { - display: none; -} - -.emotion-0 a, -.emotion-0 .button-link { - border-color: rgba(35, 107, 151, 0.40); -} - -.emotion-0 a:hover, -.emotion-0 .button-link:hover { - border-color: #236a97; -} - -.emotion-0 .alert-inner { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: stretch; - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - min-width: 1080px; - max-width: 1320px; - margin-left: auto; - margin-right: auto; - padding-left: 20px; - padding-right: 20px; - box-sizing: border-box; -} - -.emotion-0 .alert-icon { - -webkit-flex: 0 0 auto; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -ms-flex-pack: center; - -webkit-justify-content: center; - justify-content: center; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - width: calc(2 * 8px); - border-right: none; - border-color: #f4b1b0; -} - -.emotion-0 .alert-content { - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - overflow: auto; - text-align: left; - padding: 8px calc(2 * 8px); -} - -
    -
    -
    - - - alert.tooltip.error - - - -
    -
    - This is an error! -
    -
    -
    -`; - -exports[`should render properly 1`] = ` - -
    -
    - -
    -
    - This is an error! -
    -
    -
    -`; - -exports[`verification of all variants of alert 1`] = `undefined`; - -exports[`verification of all variants of alert 2`] = `undefined`; - -exports[`verification of all variants of alert 3`] = `undefined`; - -exports[`verification of all variants of alert 4`] = `undefined`; - -exports[`verification of all variants of alert 5`] = `undefined`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/AutoEllipsis-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/AutoEllipsis-test.tsx.snap deleted file mode 100644 index 84212d45e27..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/AutoEllipsis-test.tsx.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` - - my test text - -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/CoverageRating-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/CoverageRating-test.tsx.snap deleted file mode 100644 index db41604b673..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/CoverageRating-test.tsx.snap +++ /dev/null @@ -1,22 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/DismissableAlert-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/DismissableAlert-test.tsx.snap deleted file mode 100644 index 315d3fdd028..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/DismissableAlert-test.tsx.snap +++ /dev/null @@ -1,26 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - -
    - My content -
    -
    -`; - -exports[`should render correctly with a non-default display 1`] = ` - -
    - My content -
    -
    -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/GenericAvatar-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/GenericAvatar-test.tsx.snap deleted file mode 100644 index 1843c62c51e..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/GenericAvatar-test.tsx.snap +++ /dev/null @@ -1,47 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render properly 1`] = ` -
    - F -
    -`; - -exports[`should render properly 2`] = ` -
    - F -
    -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/LegacyAvatar-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/LegacyAvatar-test.tsx.snap deleted file mode 100644 index 0083612ce2f..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/LegacyAvatar-test.tsx.snap +++ /dev/null @@ -1,18 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`falls back to dummy avatar 1`] = ` - -`; - -exports[`should be able to render with hash only 1`] = ` -Foo -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Level-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Level-test.tsx.snap deleted file mode 100644 index 089171fcc17..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Level-test.tsx.snap +++ /dev/null @@ -1,43 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: default error 1`] = ` - - ERROR - -`; - -exports[`should render correctly: default ok 1`] = ` - - OK - -`; - -exports[`should render correctly: muted and small 1`] = ` - - OK - -`; - -exports[`should render correctly: with aria-label 1`] = ` - - OK - -`; - -exports[`should render correctly: with aria-labelledby 1`] = ` - - OK - -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/MandatoryFieldMarker-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/MandatoryFieldMarker-test.tsx.snap deleted file mode 100644 index 1adb77718dd..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/MandatoryFieldMarker-test.tsx.snap +++ /dev/null @@ -1,19 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: default 1`] = ` - - * - -`; - -exports[`should render correctly: with className 1`] = ` - - * - -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NavBar-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NavBar-test.tsx.snap deleted file mode 100644 index 835861f3c9d..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NavBar-test.tsx.snap +++ /dev/null @@ -1,64 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - -`; - -exports[`should render correctly with notif and not limited 1`] = ` - -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NewsBox-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NewsBox-test.tsx.snap deleted file mode 100644 index dac3a79b149..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NewsBox-test.tsx.snap +++ /dev/null @@ -1,42 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -
    -
    -
    - - new - - - title - -
    - -
    -
    -
    - description -
    -
    -
    -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Rating-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Rating-test.tsx.snap deleted file mode 100644 index ae144aba8fc..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Rating-test.tsx.snap +++ /dev/null @@ -1,48 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders numeric value 1`] = ` - - B - -`; - -exports[`renders string value 1`] = ` - - B - -`; - -exports[`renders undefined value 1`] = ` - - – - -`; - -exports[`renders with a custom aria-label 1`] = ` - - B - -`; - -exports[`renders with a custom aria-label 2`] = ` - - – - -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/SizeRating-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/SizeRating-test.tsx.snap deleted file mode 100644 index cbbdbe32d2c..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/SizeRating-test.tsx.snap +++ /dev/null @@ -1,46 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - -`; - -exports[`should render correctly 2`] = ` - -`; - -exports[`should render correctly 3`] = ` - -`; - -exports[`should render correctly 4`] = ` - -`; - -exports[`should render correctly 5`] = ` - -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/popups-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/popups-test.tsx.snap deleted file mode 100644 index 48509a51d6f..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/popups-test.tsx.snap +++ /dev/null @@ -1,79 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Popup should render Popup 1`] = ` - -
    - -
    -
    -`; - -exports[`Popup should render PopupArrow 1`] = ` -
    -`; - -exports[`PortalPopup should render correctly with overlay 1`] = ` - -