From 334782ccc54d5531fb14121c33d598758126f354 Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Wed, 6 Apr 2022 17:14:47 +0200 Subject: [PATCH] SONAR-16242 Better file structure --- .../apps/account/{components => }/Account.tsx | 18 +++++++++--------- .../__tests__/Account-test.tsx | 6 +++--- .../__snapshots__/Account-test.tsx.snap | 0 .../src/main/js/apps/account/routes.ts | 4 ++-- .../{components => security}/Security.tsx | 0 .../{components => security}/Tokens.tsx | 0 .../__tests__/Security-test.tsx | 0 .../__tests__/Tokens-test.tsx | 0 .../__snapshots__/Security-test.tsx.snap | 0 .../__snapshots__/Tokens-test.tsx.snap | 0 10 files changed, 14 insertions(+), 14 deletions(-) rename server/sonar-web/src/main/js/apps/account/{components => }/Account.tsx (77%) rename server/sonar-web/src/main/js/apps/account/{components => }/__tests__/Account-test.tsx (85%) rename server/sonar-web/src/main/js/apps/account/{components => }/__tests__/__snapshots__/Account-test.tsx.snap (100%) rename server/sonar-web/src/main/js/apps/account/{components => security}/Security.tsx (100%) rename server/sonar-web/src/main/js/apps/account/{components => security}/Tokens.tsx (100%) rename server/sonar-web/src/main/js/apps/account/{components => security}/__tests__/Security-test.tsx (100%) rename server/sonar-web/src/main/js/apps/account/{components => security}/__tests__/Tokens-test.tsx (100%) rename server/sonar-web/src/main/js/apps/account/{components => security}/__tests__/__snapshots__/Security-test.tsx.snap (100%) rename server/sonar-web/src/main/js/apps/account/{components => security}/__tests__/__snapshots__/Tokens-test.tsx.snap (100%) diff --git a/server/sonar-web/src/main/js/apps/account/components/Account.tsx b/server/sonar-web/src/main/js/apps/account/Account.tsx similarity index 77% rename from server/sonar-web/src/main/js/apps/account/components/Account.tsx rename to server/sonar-web/src/main/js/apps/account/Account.tsx index 672f3fa3da8..32a51188466 100644 --- a/server/sonar-web/src/main/js/apps/account/components/Account.tsx +++ b/server/sonar-web/src/main/js/apps/account/Account.tsx @@ -19,15 +19,15 @@ */ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; -import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; -import handleRequiredAuthentication from '../../../helpers/handleRequiredAuthentication'; -import { translate } from '../../../helpers/l10n'; -import { CurrentUser, LoggedInUser } from '../../../types/users'; -import '../account.css'; -import Nav from './Nav'; -import UserCard from './UserCard'; +import A11ySkipTarget from '../../app/components/a11y/A11ySkipTarget'; +import withCurrentUserContext from '../../app/components/current-user/withCurrentUserContext'; +import Suggestions from '../../app/components/embed-docs-modal/Suggestions'; +import handleRequiredAuthentication from '../../helpers/handleRequiredAuthentication'; +import { translate } from '../../helpers/l10n'; +import { CurrentUser, LoggedInUser } from '../../types/users'; +import './account.css'; +import Nav from './components/Nav'; +import UserCard from './components/UserCard'; interface Props { currentUser: CurrentUser; diff --git a/server/sonar-web/src/main/js/apps/account/components/__tests__/Account-test.tsx b/server/sonar-web/src/main/js/apps/account/__tests__/Account-test.tsx similarity index 85% rename from server/sonar-web/src/main/js/apps/account/components/__tests__/Account-test.tsx rename to server/sonar-web/src/main/js/apps/account/__tests__/Account-test.tsx index 4c8e60e2173..98e4f984f93 100644 --- a/server/sonar-web/src/main/js/apps/account/components/__tests__/Account-test.tsx +++ b/server/sonar-web/src/main/js/apps/account/__tests__/Account-test.tsx @@ -19,11 +19,11 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import handleRequiredAuthentication from '../../../../helpers/handleRequiredAuthentication'; -import { mockCurrentUser } from '../../../../helpers/testMocks'; +import handleRequiredAuthentication from '../../../helpers/handleRequiredAuthentication'; +import { mockCurrentUser } from '../../../helpers/testMocks'; import { Account } from '../Account'; -jest.mock('../../../../helpers/handleRequiredAuthentication', () => jest.fn()); +jest.mock('../../../helpers/handleRequiredAuthentication', () => jest.fn()); it('should render correctly', () => { const wrapper = shallowRender(); diff --git a/server/sonar-web/src/main/js/apps/account/components/__tests__/__snapshots__/Account-test.tsx.snap b/server/sonar-web/src/main/js/apps/account/__tests__/__snapshots__/Account-test.tsx.snap similarity index 100% rename from server/sonar-web/src/main/js/apps/account/components/__tests__/__snapshots__/Account-test.tsx.snap rename to server/sonar-web/src/main/js/apps/account/__tests__/__snapshots__/Account-test.tsx.snap diff --git a/server/sonar-web/src/main/js/apps/account/routes.ts b/server/sonar-web/src/main/js/apps/account/routes.ts index 81f047bbb7d..618015e7955 100644 --- a/server/sonar-web/src/main/js/apps/account/routes.ts +++ b/server/sonar-web/src/main/js/apps/account/routes.ts @@ -21,14 +21,14 @@ import { lazyLoadComponent } from '../../components/lazyLoadComponent'; const routes = [ { - component: lazyLoadComponent(() => import('./components/Account')), + component: lazyLoadComponent(() => import('./Account')), childRoutes: [ { indexRoute: { component: lazyLoadComponent(() => import('./profile/Profile')) } }, { path: 'security', - component: lazyLoadComponent(() => import('./components/Security')) + component: lazyLoadComponent(() => import('./security/Security')) }, { path: 'projects', diff --git a/server/sonar-web/src/main/js/apps/account/components/Security.tsx b/server/sonar-web/src/main/js/apps/account/security/Security.tsx similarity index 100% rename from server/sonar-web/src/main/js/apps/account/components/Security.tsx rename to server/sonar-web/src/main/js/apps/account/security/Security.tsx diff --git a/server/sonar-web/src/main/js/apps/account/components/Tokens.tsx b/server/sonar-web/src/main/js/apps/account/security/Tokens.tsx similarity index 100% rename from server/sonar-web/src/main/js/apps/account/components/Tokens.tsx rename to server/sonar-web/src/main/js/apps/account/security/Tokens.tsx diff --git a/server/sonar-web/src/main/js/apps/account/components/__tests__/Security-test.tsx b/server/sonar-web/src/main/js/apps/account/security/__tests__/Security-test.tsx similarity index 100% rename from server/sonar-web/src/main/js/apps/account/components/__tests__/Security-test.tsx rename to server/sonar-web/src/main/js/apps/account/security/__tests__/Security-test.tsx diff --git a/server/sonar-web/src/main/js/apps/account/components/__tests__/Tokens-test.tsx b/server/sonar-web/src/main/js/apps/account/security/__tests__/Tokens-test.tsx similarity index 100% rename from server/sonar-web/src/main/js/apps/account/components/__tests__/Tokens-test.tsx rename to server/sonar-web/src/main/js/apps/account/security/__tests__/Tokens-test.tsx diff --git a/server/sonar-web/src/main/js/apps/account/components/__tests__/__snapshots__/Security-test.tsx.snap b/server/sonar-web/src/main/js/apps/account/security/__tests__/__snapshots__/Security-test.tsx.snap similarity index 100% rename from server/sonar-web/src/main/js/apps/account/components/__tests__/__snapshots__/Security-test.tsx.snap rename to server/sonar-web/src/main/js/apps/account/security/__tests__/__snapshots__/Security-test.tsx.snap diff --git a/server/sonar-web/src/main/js/apps/account/components/__tests__/__snapshots__/Tokens-test.tsx.snap b/server/sonar-web/src/main/js/apps/account/security/__tests__/__snapshots__/Tokens-test.tsx.snap similarity index 100% rename from server/sonar-web/src/main/js/apps/account/components/__tests__/__snapshots__/Tokens-test.tsx.snap rename to server/sonar-web/src/main/js/apps/account/security/__tests__/__snapshots__/Tokens-test.tsx.snap -- 2.39.5