Skip to content

Commit

Permalink
fix(console-shared): folder architecture (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBonnet committed Dec 26, 2022
1 parent 311c7a9 commit eaa3c8a
Show file tree
Hide file tree
Showing 53 changed files with 132 additions and 132 deletions.
@@ -1,7 +1,7 @@
import { render } from '__tests__/utils/setup-jest'
import { ServiceTypeEnum } from '@qovery/shared/enums'
import { ApplicationContainerCreateContext } from '../page-application-create-feature'
import PageApplicationCreateGeneralFeature from './page-application-create-general-feature'
import StepGeneralFeature from './step-general-feature'

describe('PageApplicationCreateGeneralFeature', () => {
it('should render successfully', () => {
Expand All @@ -18,7 +18,7 @@ describe('PageApplicationCreateGeneralFeature', () => {
setPortData: jest.fn(),
}}
>
<PageApplicationCreateGeneralFeature />
<StepGeneralFeature />
</ApplicationContainerCreateContext.Provider>
)
expect(baseElement).toBeTruthy()
Expand Down
Expand Up @@ -10,10 +10,10 @@ import { toastError } from '@qovery/shared/toast'
import { FunnelFlowBody, FunnelFlowHelpCard } from '@qovery/shared/ui'
import { useDocumentTitle } from '@qovery/shared/utils'
import { AppDispatch, RootState } from '@qovery/store'
import PageApplicationCreateGeneral from '../../../ui/page-application-create/page-application-create-general/page-application-create-general'
import StepGeneral from '../../../ui/page-application-create/step-general/step-general'
import { useApplicationContainerCreateContext } from '../page-application-create-feature'

export function PageApplicationCreateGeneralFeature() {
export function StepGeneralFeature() {
useDocumentTitle('General - Create Application')
const { setGeneralData, generalData, setCurrentStep } = useApplicationContainerCreateContext()
const { organizationId = '', projectId = '', environmentId = '' } = useParams()
Expand Down Expand Up @@ -81,10 +81,10 @@ export function PageApplicationCreateGeneralFeature() {
return (
<FunnelFlowBody helpSection={funnelCardHelp}>
<FormProvider {...methods}>
<PageApplicationCreateGeneral organization={organization} onSubmit={onSubmit} />
<StepGeneral organization={organization} onSubmit={onSubmit} />
</FormProvider>
</FunnelFlowBody>
)
}

export default PageApplicationCreateGeneralFeature
export default StepGeneralFeature
Expand Up @@ -2,7 +2,7 @@ import { act, getByTestId } from '@testing-library/react'
import { render } from '__tests__/utils/setup-jest'
import { ServiceTypeEnum } from '@qovery/shared/enums'
import { ApplicationContainerCreateContext } from '../page-application-create-feature'
import PageApplicationCreatePortFeature from './page-application-create-port-feature'
import StepPortFeature from './step-port-feature'

describe('PageApplicationCreatePortFeature', () => {
let context: any
Expand Down Expand Up @@ -31,7 +31,7 @@ describe('PageApplicationCreatePortFeature', () => {
it('should render successfully', () => {
const { baseElement } = render(
<ApplicationContainerCreateContext.Provider value={context}>
<PageApplicationCreatePortFeature />
<StepPortFeature />
</ApplicationContainerCreateContext.Provider>
)
expect(baseElement).toBeTruthy()
Expand All @@ -40,7 +40,7 @@ describe('PageApplicationCreatePortFeature', () => {
it('should submit the data to the context', async () => {
const { baseElement } = render(
<ApplicationContainerCreateContext.Provider value={context}>
<PageApplicationCreatePortFeature />
<StepPortFeature />
</ApplicationContainerCreateContext.Provider>
)

Expand Down
Expand Up @@ -14,7 +14,7 @@ import { FunnelFlowBody, FunnelFlowHelpCard } from '@qovery/shared/ui'
import { useDocumentTitle } from '@qovery/shared/utils'
import { useApplicationContainerCreateContext } from '../page-application-create-feature'

export function PageApplicationCreatePortFeature() {
export function StepPortFeature() {
useDocumentTitle('Ports - Create Application')
const { setCurrentStep, portData, setPortData, generalData } = useApplicationContainerCreateContext()
const { organizationId = '', projectId = '', environmentId = '' } = useParams()
Expand Down Expand Up @@ -105,4 +105,4 @@ export function PageApplicationCreatePortFeature() {
)
}

export default PageApplicationCreatePortFeature
export default StepPortFeature
Expand Up @@ -2,7 +2,7 @@ import ResizeObserver from '__tests__/utils/resize-observer'
import { render } from '__tests__/utils/setup-jest'
import { ServiceTypeEnum } from '@qovery/shared/enums'
import { ApplicationContainerCreateContext } from '../page-application-create-feature'
import PageApplicationCreateResourcesFeature from './page-application-create-resources-feature'
import StepResourcesFeature from './step-resources-feature'

describe('PageApplicationCreateResourcesFeature', () => {
it('should render successfully', () => {
Expand All @@ -24,7 +24,7 @@ describe('PageApplicationCreateResourcesFeature', () => {
portData: undefined,
}}
>
<PageApplicationCreateResourcesFeature />
<StepResourcesFeature />
</ApplicationContainerCreateContext.Provider>
)
expect(baseElement).toBeTruthy()
Expand Down
Expand Up @@ -15,10 +15,10 @@ import {
import { FunnelFlowBody, FunnelFlowHelpCard } from '@qovery/shared/ui'
import { useDocumentTitle } from '@qovery/shared/utils'
import { RootState } from '@qovery/store'
import PageApplicationCreateResources from '../../../ui/page-application-create/page-application-create-resources/page-application-create-resources'
import StepResources from '../../../ui/page-application-create/step-resources/step-resources'
import { useApplicationContainerCreateContext } from '../page-application-create-feature'

export function PageApplicationCreateResourcesFeature() {
export function StepResourcesFeature() {
useDocumentTitle('Resources - Create Application')
const { setCurrentStep, resourcesData, setResourcesData, generalData } = useApplicationContainerCreateContext()
const { organizationId = '', projectId = '', environmentId = '' } = useParams()
Expand Down Expand Up @@ -93,10 +93,10 @@ export function PageApplicationCreateResourcesFeature() {
return (
<FunnelFlowBody helpSection={funnelCardHelp}>
<FormProvider {...methods}>
<PageApplicationCreateResources maximumInstances={maxInstances} onBack={onBack} onSubmit={onSubmit} />
<StepResources maximumInstances={maxInstances} onBack={onBack} onSubmit={onSubmit} />
</FormProvider>
</FunnelFlowBody>
)
}

export default PageApplicationCreateResourcesFeature
export default StepResourcesFeature
Expand Up @@ -8,7 +8,7 @@ import {
ApplicationContainerCreateContext,
ApplicationContainerCreateContextInterface,
} from '../page-application-create-feature'
import PageApplicationPostFeature from './page-application-post-feature'
import StepSummaryFeature from './step-summary-feature'

import SpyInstance = jest.SpyInstance

Expand Down Expand Up @@ -70,7 +70,7 @@ describe('PageApplicationPostFeature', () => {
it('should render successfully', () => {
const { baseElement } = render(
<ApplicationContainerCreateContext.Provider value={mockContext}>
<PageApplicationPostFeature />
<StepSummaryFeature />
</ApplicationContainerCreateContext.Provider>
)

Expand Down Expand Up @@ -104,7 +104,7 @@ describe('PageApplicationPostFeature', () => {
},
}}
>
<PageApplicationPostFeature />
<StepSummaryFeature />
</ApplicationContainerCreateContext.Provider>
)

Expand Down Expand Up @@ -159,7 +159,7 @@ describe('PageApplicationPostFeature', () => {
},
}}
>
<PageApplicationPostFeature />
<StepSummaryFeature />
</ApplicationContainerCreateContext.Provider>
)

Expand Down
Expand Up @@ -22,10 +22,10 @@ import {
import { FunnelFlowBody } from '@qovery/shared/ui'
import { buildGitRepoUrl, convertCpuToVCpu, useDocumentTitle } from '@qovery/shared/utils'
import { AppDispatch, RootState } from '@qovery/store'
import PageApplicationPost from '../../../ui/page-application-create/page-application-post/page-application-post'
import StepSummary from '../../../ui/page-application-create/step-summary/step-summary'
import { useApplicationContainerCreateContext } from '../page-application-create-feature'

export function PageApplicationPostFeature() {
export function StepSummaryFeature() {
useDocumentTitle('Summary - Create Application')
const { generalData, portData, resourcesData, setCurrentStep } = useApplicationContainerCreateContext()
const navigate = useNavigate()
Expand Down Expand Up @@ -178,7 +178,7 @@ export function PageApplicationPostFeature() {
return (
<FunnelFlowBody>
{generalData && portData && resourcesData && (
<PageApplicationPost
<StepSummary
isLoadingCreate={loadingCreate}
isLoadingCreateAndDeploy={loadingCreateAndDeploy}
onSubmit={onSubmit}
Expand All @@ -198,4 +198,4 @@ export function PageApplicationPostFeature() {
)
}

export default PageApplicationPostFeature
export default StepSummaryFeature
Expand Up @@ -3,7 +3,7 @@ import { getByTestId, render } from '__tests__/utils/setup-jest'
import { DatabaseAccessibilityEnum, DatabaseModeEnum, DatabaseTypeEnum } from 'qovery-typescript-axios'
import { ReactNode } from 'react'
import { DatabaseCreateContext } from '../page-database-create-feature'
import PageDatabaseCreateGeneralFeature from './page-database-create-general-feature'
import StepGeneralFeature from './step-general-feature'

const mockSetGeneralData = jest.fn()
const mockNavigate = jest.fn()
Expand Down Expand Up @@ -47,11 +47,11 @@ const ContextWrapper = (props: { children: ReactNode }) => {
)
}

describe('PageDatabaseCreateGeneralFeature', () => {
describe('StepGeneralFeature', () => {
it('should render successfully', async () => {
const { baseElement } = render(
<ContextWrapper>
<PageDatabaseCreateGeneralFeature />
<StepGeneralFeature />
</ContextWrapper>
)

Expand All @@ -62,7 +62,7 @@ describe('PageDatabaseCreateGeneralFeature', () => {
it('should submit form and navigate', async () => {
const { baseElement } = render(
<ContextWrapper>
<PageDatabaseCreateGeneralFeature />
<StepGeneralFeature />
</ContextWrapper>
)

Expand Down
Expand Up @@ -14,7 +14,7 @@ import {
import { FunnelFlowBody, FunnelFlowHelpCard, Icon } from '@qovery/shared/ui'
import { useDocumentTitle } from '@qovery/shared/utils'
import { AppDispatch, RootState } from '@qovery/store'
import PageDatabaseCreateGeneral from '../../../ui/page-database-create/page-database-create-general/page-database-create-general'
import StepGeneral from '../../../ui/page-database-create/step-general/step-general'
import { GeneralData } from '../database-creation-flow.interface'
import { useDatabaseCreateContext } from '../page-database-create-feature'

Expand Down Expand Up @@ -71,7 +71,7 @@ export const generateDatabasesTypesAndVersionOptions = (databaseConfigs: Databas
}
}

export function PageDatabaseCreateGeneralFeature() {
export function StepGeneralFeature() {
useDocumentTitle('General - Create Database')
const { setGeneralData, generalData, setCurrentStep } = useDatabaseCreateContext()
const { organizationId = '', projectId = '', environmentId = '' } = useParams()
Expand Down Expand Up @@ -162,7 +162,7 @@ export function PageDatabaseCreateGeneralFeature() {
return (
<FunnelFlowBody helpSection={funnelCardHelp}>
<FormProvider {...methods}>
<PageDatabaseCreateGeneral
<StepGeneral
cloudProvider={environment?.cloud_provider.provider}
onSubmit={onSubmit}
databaseTypeOptions={databaseTypeOptions}
Expand All @@ -173,4 +173,4 @@ export function PageDatabaseCreateGeneralFeature() {
)
}

export default PageDatabaseCreateGeneralFeature
export default StepGeneralFeature
Expand Up @@ -4,8 +4,7 @@ import { getByTestId, render } from '__tests__/utils/setup-jest'
import { DatabaseAccessibilityEnum, DatabaseModeEnum, DatabaseTypeEnum } from 'qovery-typescript-axios'
import { ReactNode } from 'react'
import { DatabaseCreateContext } from '../page-database-create-feature'
import PageDatabaseCreateGeneralFeature from '../page-database-create-general-feature/page-database-create-general-feature'
import PageDatabaseCreateResourcesFeature from './page-database-create-resources-feature'
import StepResourcesFeature from './step-resources-feature'

jest.mock('react-redux', () => ({
...jest.requireActual('react-redux'),
Expand Down Expand Up @@ -51,7 +50,7 @@ describe('PageDatabaseCreateResourcesFeature', () => {
it('should render successfully', () => {
const { baseElement } = render(
<ContextWrapper>
<PageDatabaseCreateResourcesFeature />
<StepResourcesFeature />
</ContextWrapper>
)
expect(baseElement).toBeTruthy()
Expand All @@ -60,7 +59,7 @@ describe('PageDatabaseCreateResourcesFeature', () => {
it('should render successfully', () => {
const { baseElement } = render(
<ContextWrapper>
<PageDatabaseCreateGeneralFeature />
<StepResourcesFeature />
</ContextWrapper>
)
expect(baseElement).toBeTruthy()
Expand All @@ -70,7 +69,7 @@ describe('PageDatabaseCreateResourcesFeature', () => {
window.ResizeObserver = ResizeObserver
const { baseElement } = render(
<ContextWrapper>
<PageDatabaseCreateResourcesFeature />
<StepResourcesFeature />
</ContextWrapper>
)

Expand Down
Expand Up @@ -9,11 +9,11 @@ import {
} from '@qovery/shared/router'
import { FunnelFlowBody, FunnelFlowHelpCard } from '@qovery/shared/ui'
import { useDocumentTitle } from '@qovery/shared/utils'
import PageDatabaseCreateResources from '../../../ui/page-database-create/page-database-create-resources/page-database-create-resources'
import StepResources from '../../../ui/page-database-create/step-resources/step-resources'
import { ResourcesData } from '../database-creation-flow.interface'
import { useDatabaseCreateContext } from '../page-database-create-feature'

export function PageDatabaseCreateResourcesFeature() {
export function StepResourcesFeature() {
useDocumentTitle('Resources - Create Database')
const { setCurrentStep, resourcesData, setResourcesData, generalData } = useDatabaseCreateContext()
const { organizationId = '', projectId = '', environmentId = '' } = useParams()
Expand Down Expand Up @@ -71,10 +71,10 @@ export function PageDatabaseCreateResourcesFeature() {
return (
<FunnelFlowBody helpSection={funnelCardHelp}>
<FormProvider {...methods}>
<PageDatabaseCreateResources onBack={onBack} onSubmit={onSubmit} />
<StepResources onBack={onBack} onSubmit={onSubmit} />
</FormProvider>
</FunnelFlowBody>
)
}

export default PageDatabaseCreateResourcesFeature
export default StepResourcesFeature
Expand Up @@ -4,7 +4,7 @@ import { DatabaseAccessibilityEnum, DatabaseModeEnum, DatabaseTypeEnum } from 'q
import { ReactNode } from 'react'
import * as storeDatabase from '@qovery/domains/database'
import { DatabaseCreateContext } from '../page-database-create-feature'
import PageDatabaseCreatePostFeature from './page-database-create-post-feature'
import StepSummaryFeature from './step-summary-feature'

import SpyInstance = jest.SpyInstance

Expand Down Expand Up @@ -49,11 +49,11 @@ const ContextWrapper = (props: { children: ReactNode }) => {
)
}

describe('PageDatabaseCreatePostFeature', () => {
describe('StepSummaryFeature', () => {
it('should render successfully', () => {
const { baseElement } = render(
<ContextWrapper>
<PageDatabaseCreatePostFeature />
<StepSummaryFeature />
</ContextWrapper>
)
expect(baseElement).toBeTruthy()
Expand All @@ -74,7 +74,7 @@ describe('PageDatabaseCreatePostFeature', () => {
}))
const { baseElement } = render(
<ContextWrapper>
<PageDatabaseCreatePostFeature />
<StepSummaryFeature />
</ContextWrapper>
)

Expand Down
Expand Up @@ -12,10 +12,10 @@ import {
import { FunnelFlowBody } from '@qovery/shared/ui'
import { convertCpuToVCpu, useDocumentTitle } from '@qovery/shared/utils'
import { AppDispatch } from '@qovery/store'
import PageDatabaseCreatePost from '../../../ui/page-database-create/page-database-create-post/page-database-create-post'
import StepSummary from '../../../ui/page-database-create/step-summary/step-summary'
import { useDatabaseCreateContext } from '../page-database-create-feature'

export function PageDatabaseCreatePostFeature() {
export function StepSummaryFeature() {
useDocumentTitle('Summary - Create Database')
const { generalData, resourcesData, setCurrentStep } = useDatabaseCreateContext()
const navigate = useNavigate()
Expand Down Expand Up @@ -103,7 +103,7 @@ export function PageDatabaseCreatePostFeature() {
return (
<FunnelFlowBody>
{generalData && resourcesData && (
<PageDatabaseCreatePost
<StepSummary
isLoadingCreate={loadingCreate}
isLoadingCreateAndDeploy={loadingCreateAndDeploy}
onSubmit={onSubmit}
Expand All @@ -118,4 +118,4 @@ export function PageDatabaseCreatePostFeature() {
)
}

export default PageDatabaseCreatePostFeature
export default StepSummaryFeature

0 comments on commit eaa3c8a

Please sign in to comment.