From cc7c40ced053d5ba7bcc453b28f9cfcdf022a180 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Fri, 13 Oct 2017 15:45:56 +0200 Subject: [PATCH] SONAR-9935 Add some unit tests --- .../main/js/apps/marketplace/PluginsList.tsx | 4 +- .../marketplace/__tests__/Footer-test.tsx | 26 +++++ .../__tests__/PendingActions-test.tsx | 94 +++++++++++++++++++ .../__snapshots__/Footer-test.tsx.snap | 9 ++ .../PendingActions-test.tsx.snap | 67 +++++++++++++ .../{ => components}/PluginActions.tsx | 0 .../{ => components}/PluginAvailable.tsx | 6 +- .../{ => components}/PluginChangeLog.tsx | 6 +- .../PluginChangeLogButton.tsx | 4 +- .../{ => components}/PluginChangeLogItem.tsx | 8 +- .../{ => components}/PluginDescription.tsx | 4 +- .../{ => components}/PluginInstalled.tsx | 6 +- .../{ => components}/PluginLicense.tsx | 2 +- .../{ => components}/PluginOrganization.tsx | 4 +- .../{ => components}/PluginStatus.tsx | 4 +- .../{ => components}/PluginUpdateButton.tsx | 4 +- .../{ => components}/PluginUpdateItem.tsx | 6 +- .../{ => components}/PluginUpdates.tsx | 4 +- .../{ => components}/PluginUrls.tsx | 4 +- .../__tests__/PluginDescription-test.tsx | 55 +++++++++++ .../__tests__/PluginLicense-test.tsx | 30 ++++++ .../components/__tests__/PluginUrls-test.tsx | 49 ++++++++++ .../PluginDescription-test.tsx.snap | 46 +++++++++ .../__snapshots__/PluginLicense-test.tsx.snap | 24 +++++ .../__snapshots__/PluginUrls-test.tsx.snap | 52 ++++++++++ 25 files changed, 485 insertions(+), 33 deletions(-) create mode 100644 server/sonar-web/src/main/js/apps/marketplace/__tests__/Footer-test.tsx create mode 100644 server/sonar-web/src/main/js/apps/marketplace/__tests__/PendingActions-test.tsx create mode 100644 server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/Footer-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/PendingActions-test.tsx.snap rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginActions.tsx (100%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginAvailable.tsx (94%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginChangeLog.tsx (91%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginChangeLogButton.tsx (93%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginChangeLogItem.tsx (88%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginDescription.tsx (95%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginInstalled.tsx (94%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginLicense.tsx (96%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginOrganization.tsx (94%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginStatus.tsx (94%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginUpdateButton.tsx (92%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginUpdateItem.tsx (93%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginUpdates.tsx (94%) rename server/sonar-web/src/main/js/apps/marketplace/{ => components}/PluginUrls.tsx (94%) create mode 100644 server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginDescription-test.tsx create mode 100644 server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginLicense-test.tsx create mode 100644 server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginUrls-test.tsx create mode 100644 server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginDescription-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginLicense-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginUrls-test.tsx.snap diff --git a/server/sonar-web/src/main/js/apps/marketplace/PluginsList.tsx b/server/sonar-web/src/main/js/apps/marketplace/PluginsList.tsx index 0e51d154342..df07149f700 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/PluginsList.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/PluginsList.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import PluginAvailable from './PluginAvailable'; -import PluginInstalled from './PluginInstalled'; +import PluginAvailable from './components/PluginAvailable'; +import PluginInstalled from './components/PluginInstalled'; import { isPluginAvailable, isPluginInstalled, Query } from './utils'; import { Plugin, PluginPending } from '../../api/plugins'; diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/Footer-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/__tests__/Footer-test.tsx new file mode 100644 index 00000000000..58e9f4b8390 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/Footer-test.tsx @@ -0,0 +1,26 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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 * as React from 'react'; +import { shallow } from 'enzyme'; +import Footer from '../Footer'; + +it('should display the number of plugins', () => { + expect(shallow(