diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/iam/iam.mock.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/iam/iam.mock.ts index 9c7b36f89c6a..2ef5404743a0 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/iam/iam.mock.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/iam/iam.mock.ts @@ -1,4 +1,5 @@ import { IamCheckResponse } from '@ovh-ux/manager-react-components'; +import { datacentreList } from '../vcd-organization/vcd-datacentre.mock'; import { organizationList } from '../vcd-organization/vcd-organization.mock'; import { iamActions } from '@/utils/iam.constants'; @@ -19,4 +20,11 @@ export const resourceList: IamCheckResponse[] = [ ], unauthorizedActions: [], }, + { + urn: datacentreList[0].iam.urn, + authorizedActions: [ + iamActions.vmwareCloudDirectorApiovhOrganizationVirtualDataCenterEdit, + ], + unauthorizedActions: [], + }, ]; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/index.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/index.ts index 05a214fbbb99..3d40b59a8819 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/index.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/index.ts @@ -1,3 +1,4 @@ export * from './iam/iam.handler'; export * from './vcd-organization/vcd-organization.handler'; +export * from './vcd-organization/vcd-datacentre-order.handler'; export * from './veeam-backup/veeam-backup.handler'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-catalog.mock.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-catalog.mock.ts new file mode 100644 index 000000000000..8d03032dd813 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-catalog.mock.ts @@ -0,0 +1,156 @@ +import { TVcdCatalog } from '../../src/types/vcd-catalog.interface'; + +export const catalogProductList: TVcdCatalog = [ + { + productName: 'pack-3264', + mandatory: false, + exclusive: false, + family: 'host_order', + productType: 'cloud_service', + planCode: 'pack-3264', + prices: [ + { + priceInUcents: 0, + pricingType: 'rental', + maximumRepeat: 1, + price: { currencyCode: 'EUR', text: '0.00 €', value: 0 }, + minimumRepeat: 1, + capacities: ['installation'], + duration: 'P0D', + maximumQuantity: null, + interval: 0, + description: 'Installation pricing', + pricingMode: 'default', + minimumQuantity: 1, + }, + { + pricingMode: 'default', + minimumQuantity: 1, + description: 'Installation pricing', + interval: 1, + maximumQuantity: null, + duration: 'P1M', + capacities: ['renew'], + minimumRepeat: 1, + price: { value: 80, text: '80.00 €', currencyCode: 'EUR' }, + maximumRepeat: null, + pricingType: 'rental', + priceInUcents: 8_000_000_000, + }, + ], + }, + { + productName: 'pack-1664', + mandatory: false, + exclusive: false, + family: 'host_order', + productType: 'cloud_service', + planCode: 'pack-1664', + prices: [ + { + capacities: ['installation'], + minimumRepeat: 1, + duration: 'P0D', + pricingType: 'rental', + priceInUcents: 0, + price: { text: '0.00 €', currencyCode: 'EUR', value: 0 }, + maximumRepeat: 1, + description: 'Installation pricing', + minimumQuantity: 1, + pricingMode: 'default', + maximumQuantity: null, + interval: 0, + }, + { + pricingMode: 'default', + minimumQuantity: 1, + description: 'Installation pricing', + maximumQuantity: null, + interval: 1, + duration: 'P1M', + capacities: ['renew'], + minimumRepeat: 1, + pricingType: 'rental', + priceInUcents: 8_000_000_000, + price: { text: '80.00 €', currencyCode: 'EUR', value: 80 }, + maximumRepeat: null, + }, + ], + }, + { + productType: 'cloud_service', + planCode: 'pack-16128', + prices: [ + { + maximumQuantity: null, + interval: 0, + minimumQuantity: 1, + pricingMode: 'default', + description: 'Installation pricing', + priceInUcents: 0, + pricingType: 'rental', + maximumRepeat: 1, + price: { value: 0, text: '0.00 €', currencyCode: 'EUR' }, + duration: 'P0D', + minimumRepeat: 1, + capacities: ['installation'], + }, + { + minimumQuantity: 1, + pricingMode: 'default', + description: 'Installation pricing', + interval: 1, + maximumQuantity: null, + duration: 'P1M', + minimumRepeat: 1, + capacities: ['renew'], + maximumRepeat: null, + price: { value: 80, currencyCode: 'EUR', text: '80.00 €' }, + priceInUcents: 8_000_000_000, + pricingType: 'rental', + }, + ], + productName: 'pack-16128', + mandatory: false, + family: 'host_order', + exclusive: false, + }, + { + prices: [ + { + maximumQuantity: null, + interval: 0, + description: 'Installation pricing', + minimumQuantity: 1, + pricingMode: 'default', + pricingType: 'rental', + priceInUcents: 0, + price: { value: 0, currencyCode: 'EUR', text: '0.00 €' }, + maximumRepeat: 1, + capacities: ['installation'], + minimumRepeat: 1, + duration: 'P0D', + }, + { + minimumRepeat: 1, + capacities: ['renew'], + duration: 'P1M', + priceInUcents: 8_000_000_000, + pricingType: 'rental', + maximumRepeat: null, + price: { value: 80, currencyCode: 'EUR', text: '80.00 €' }, + description: 'Installation pricing', + pricingMode: 'default', + minimumQuantity: 1, + maximumQuantity: null, + interval: 1, + }, + ], + planCode: 'vcd-datastore-1000', + productType: 'cloud_service', + family: 'storage_order', + exclusive: false, + mandatory: false, + productName: 'vcd-datastore-1000', + }, +]; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre-order.handler.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre-order.handler.ts new file mode 100644 index 000000000000..ac2af6c75a35 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre-order.handler.ts @@ -0,0 +1,43 @@ +import { IVdcOrderableResourceData } from '@/types/vcd-vdc-orderable-resource.interface'; +import { Handler } from '../../../../../../playwright-helpers'; +import { catalogProductList } from './vcd-catalog.mock'; +import { orderableResourceData } from './vdc-orderable-resource.mock'; + +export type GetDatacentreOrderMocksParams = { + isCatalogKO?: boolean; + nbCatalogProduct?: number; + isOrderableResourceKO?: boolean; + nbOrderableResource?: number; +}; + +export const getDatacentreOrderMocks = ({ + isCatalogKO, + nbCatalogProduct = Number.POSITIVE_INFINITY, + isOrderableResourceKO, + nbOrderableResource = Number.POSITIVE_INFINITY, +}: GetDatacentreOrderMocksParams): Handler[] => { + const selectedOrderableResource: IVdcOrderableResourceData = { + compute: orderableResourceData.compute.slice(0, nbOrderableResource), + storage: orderableResourceData.storage.slice(0, nbOrderableResource), + }; + + return [ + { + url: + '/vmwareCloudDirector/organization/:id/virtualDataCenter/:id/orderableResource', + response: isOrderableResourceKO + ? { message: 'OrderableResource error' } + : selectedOrderableResource, + api: 'v2', + status: isOrderableResourceKO ? 500 : 200, + }, + { + url: '/order/cartServiceOption/vmwareCloudDirector/:id', + response: isCatalogKO + ? { message: 'Catalog error' } + : catalogProductList.slice(0, nbCatalogProduct), + api: 'v6', + status: isCatalogKO ? 500 : 200, + }, + ]; +}; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre.mock.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre.mock.ts index f3830048da4b..32446b83efd0 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre.mock.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre.mock.ts @@ -6,8 +6,7 @@ export const datacentreList: IVcdDatacentre[] = [ resourceStatus: 'READY', currentState: { commercialRange: 'STANDARD', - description: - 'Pour vous proposer une description adaptée, pourriez-vous me donner plus de détails sur votre service ? Cela me permettra de créer une description précise et impactante qui tient dans la limite des 255 caractères.', + description: 'VDC Description', ipQuota: 10, memoryQuota: 64, name: 'vdc-eu-central-waw-adc311b5-0c0b-4071-b48f-b20813868bcf', @@ -18,8 +17,7 @@ export const datacentreList: IVcdDatacentre[] = [ }, currentTasks: [], targetSpec: { - description: - 'Pour vous proposer une description adaptée, pourriez-vous me donner plus de détails sur votre service ? Cela me permettra de créer une description précise et impactante qui tient dans la limite des 255 caractères.', + description: 'VDC Description targetSpec', vCPUSpeed: 3, }, updatedAt: '2024-09-23T13:53:49Z', diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.handler.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.handler.ts index f7946ad71e6a..68da1e813be3 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.handler.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.handler.ts @@ -2,6 +2,8 @@ import { PathParams } from 'msw'; import { Handler } from '../../../../../../playwright-helpers'; import { organizationList } from './vcd-organization.mock'; import { datacentreList } from './vcd-datacentre.mock'; +import { computeList } from './vdc-compute.mock'; +import { storageList } from './vdc-storage.mock'; export type GetOrganizationMocksParams = { isOrganizationKo?: boolean; @@ -9,38 +11,83 @@ export type GetOrganizationMocksParams = { nbOrganization?: number; allOrgsBackedUp?: boolean; isDatacentresKo?: boolean; + isDatacentreUpdateKo?: boolean; nbDatacentres?: number; + isComputeKO?: boolean; + nbCompute?: number; + isStorageKO?: boolean; + nbStorage?: number; }; const findOrganizationById = (params: PathParams) => organizationList.find(({ id }) => id === params.id); +const findDatacentreById = (params: PathParams) => + datacentreList.find(({ id }) => id === params.id); + export const getOrganizationMocks = ({ isOrganizationKo, isOrganizationUpdateKo, nbOrganization = Number.POSITIVE_INFINITY, allOrgsBackedUp, isDatacentresKo, + isDatacentreUpdateKo, nbDatacentres = Number.POSITIVE_INFINITY, + isComputeKO, + nbCompute = Number.POSITIVE_INFINITY, + isStorageKO, + nbStorage = Number.POSITIVE_INFINITY, }: GetOrganizationMocksParams): Handler[] => { const nb = allOrgsBackedUp ? 1 : nbOrganization; return [ + { + url: + '/vmwareCloudDirector/organization/:id/virtualDataCenter/:id/storage', + response: isStorageKO + ? { message: 'Storage error' } + : storageList.slice(0, nbStorage), + api: 'v2', + status: isStorageKO ? 500 : 200, + }, + { + url: + '/vmwareCloudDirector/organization/:id/virtualDataCenter/:id/compute', + response: isComputeKO + ? { message: 'Compute error' } + : computeList.slice(0, nbCompute), + api: 'v2', + status: isComputeKO ? 500 : 200, + }, { url: '/vmwareCloudDirector/organization/:id/virtualDataCenter', response: isDatacentresKo - ? { - message: 'Datacentres error', - } + ? { message: 'Datacentres error' } : datacentreList.slice(0, nbDatacentres), api: 'v2', status: isDatacentresKo ? 500 : 200, }, + { + url: '/vmwareCloudDirector/organization/:id/virtualDataCenter/:id', + response: (_: unknown, params: PathParams) => + isDatacentresKo + ? { message: 'Datacentre error' } + : findDatacentreById(params), + api: 'v2', + status: isDatacentresKo ? 500 : 200, + }, + { + url: '/vmwareCloudDirector/organization/:id/virtualDataCenter/:id', + response: isDatacentreUpdateKo + ? { message: 'Datacentre update error' } + : {}, + method: 'put', + api: 'v2', + status: isDatacentreUpdateKo ? 500 : 200, + }, { url: '/vmwareCloudDirector/organization/:id', response: isOrganizationUpdateKo - ? { - message: 'Organization update error', - } + ? { message: 'Organization update error' } : {}, method: 'put', api: 'v2', @@ -50,9 +97,7 @@ export const getOrganizationMocks = ({ url: '/vmwareCloudDirector/organization/:id', response: (_: unknown, params: PathParams) => isOrganizationKo - ? { - message: 'Organization error', - } + ? { message: 'Organization error' } : findOrganizationById(params), api: 'v2', status: isOrganizationKo ? 500 : 200, @@ -60,9 +105,7 @@ export const getOrganizationMocks = ({ { url: '/vmwareCloudDirector/organization', response: isOrganizationKo - ? { - message: 'Organization error', - } + ? { message: 'Organization error' } : organizationList.slice(0, nb), status: isOrganizationKo ? 500 : 200, api: 'v2', diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.mock.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.mock.ts index 963b0a20aedf..bb0f3dc62c8c 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.mock.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.mock.ts @@ -24,8 +24,8 @@ export const organizationList: IVcdOrganization[] = [ id: '6cfa2c69-c62c-4853-80ee-c9682e6727f0', resourceStatus: 'UPDATING', targetSpec: { - description: 'Company production VCD Organization', - fullName: 'Company VCD', + description: 'Company VCD Organization targetSpec', + fullName: 'Company VCD targetSpec', }, updatedAt: '2024-06-14T09:21:21.943Z', iam: { @@ -48,8 +48,8 @@ export const organizationList: IVcdOrganization[] = [ id: '61ebdcec-0623-4a61-834f-a1719cd475b4', resourceStatus: 'READY', targetSpec: { - description: 'My demo VCD Organization', - fullName: 'Demo VCD', + description: 'My demo VCD Organization targetSpec', + fullName: 'Demo VCD targetSpec', }, updatedAt: '2024-06-14T09:21:21.943Z', iam: { diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-compute.mock.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-compute.mock.ts new file mode 100644 index 000000000000..a0a42ed9cfb2 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-compute.mock.ts @@ -0,0 +1,28 @@ +import IVcdCompute from '../../src/types/vcd-compute.interface'; + +export const computeList: IVcdCompute[] = [ + { + id: 'f578c64f-ebec-4c19-a006-c96b1c7c1b95', + resourceStatus: 'READY', + currentState: { + billingType: 'MONTHLY', + memoryQuota: 32, + name: 'vhost-4-32', + profile: 'vhost-4-32', + vCPUCount: 8, + }, + currentTasks: [], + }, + { + id: '6873cbc3-d158-4cdc-8d37-b2d8dded3457', + resourceStatus: 'READY', + currentState: { + billingType: 'MONTHLY', + memoryQuota: 32, + name: 'vhost-4-32', + profile: 'vhost-4-32', + vCPUCount: 8, + }, + currentTasks: [], + }, +]; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-orderable-resource.mock.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-orderable-resource.mock.ts new file mode 100644 index 000000000000..a62528086349 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-orderable-resource.mock.ts @@ -0,0 +1,35 @@ +import { IVdcOrderableResourceData } from '../../src/types/vcd-vdc-orderable-resource.interface'; + +export const orderableResourceData: IVdcOrderableResourceData = { + compute: [ + { + memoryQuota: 64, + name: 'vhost-32-64', + profile: 'pack-3264', + vCPUCount: 32, + vCPUSpeed: 3, + }, + { + memoryQuota: 64, + name: 'vhost-16-64', + profile: 'pack-1664', + vCPUCount: 16, + vCPUSpeed: 3, + }, + { + memoryQuota: 128, + name: 'vhost-16-128', + profile: 'pack-16128', + vCPUCount: 16, + vCPUSpeed: 3, + }, + ], + storage: [ + { + capacity: 1000, + name: 'vcd-datastore-1000', + profile: 'vcd-datastore-1000', + type: 'storage', + }, + ], +}; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-storage.mock.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-storage.mock.ts new file mode 100644 index 000000000000..e3538f33c932 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-storage.mock.ts @@ -0,0 +1,28 @@ +import IVcdStorage from '../../src/types/vcd-storage.interface'; + +export const storageList: IVcdStorage[] = [ + { + id: 'fccce864-e1d5-4ab8-ad6a-79ecd295f420', + resourceStatus: 'READY', + currentState: { + billingType: 'MONTHLY', + capacity: 300, + name: 'vcd-datastore-300', + profile: 'vcd-datastore-300', + type: 'DEFAULT', + }, + currentTasks: [], + }, + { + id: 'b683b2d1-2387-46da-8e1b-76ebbee0dba9', + resourceStatus: 'READY', + currentState: { + billingType: 'MONTHLY', + capacity: 300, + name: 'vcd-datastore-300', + profile: 'vcd-datastore-300', + type: 'DEFAULT', + }, + currentTasks: [], + }, +]; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.spec.tsx new file mode 100644 index 000000000000..d0fa0db2482e --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.spec.tsx @@ -0,0 +1,22 @@ +import { checkTextVisibility, labels, renderTest } from '../../../test-utils'; +import { datacentreList } from '../../../../mocks/vcd-organization/vcd-datacentre.mock'; +import { organizationList } from '../../../../mocks/vcd-organization/vcd-organization.mock'; + +describe('Datacentre Dashboard Page', () => { + it('display the datacentre dashboard page', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}`, + }); + + await checkTextVisibility(labels.datacentres.managed_vcd_vdc_vcpu_count); + }); + + it('display an error', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}`, + isDatacentresKo: true, + }); + + await checkTextVisibility('Datacentre error'); + }); +}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.spec.tsx new file mode 100644 index 000000000000..22e78b6a5ccc --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.spec.tsx @@ -0,0 +1,59 @@ +import { screen, waitFor } from '@testing-library/dom'; +import userEvent from '@testing-library/user-event'; +import { + checkTextVisibility, + labels, + renderTest, +} from '../../../../test-utils'; +import { datacentreList } from '../../../../../mocks/vcd-organization/vcd-datacentre.mock'; +import { organizationList } from '../../../../../mocks/vcd-organization/vcd-organization.mock'; + +const orderCTA = labels.datacentresCompute.managed_vcd_vdc_compute_order_cta; +const orderTitle = orderCTA; +const orderError = labels.datacentresOrder.managed_vcd_vdc_order_unavailable; + +describe('Datacentre Compute Order Page', () => { + it('access and display compute order page', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/compute`, + }); + + await checkTextVisibility(orderCTA); + const orderButton = screen.getByText(orderCTA); + await waitFor(() => userEvent.click(orderButton)); + + await checkTextVisibility(orderTitle); + }); + + it('display an error if orderableResource service is KO', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/compute/order`, + isOrderableResourceKO: true, + }); + await checkTextVisibility(orderError); + }); + + it('display an error if there is no orderableResource', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/compute/order`, + nbOrderableResource: 0, + }); + await checkTextVisibility(orderError); + }); + + it('display an error if catalog service is KO', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/compute/order`, + isCatalogKO: true, + }); + await checkTextVisibility(orderError); + }); + + it('display an error if there is no catalog products', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/compute/order`, + nbCatalogProduct: 0, + }); + await checkTextVisibility(orderError); + }); +}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/DatacentreCompute.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/DatacentreCompute.spec.tsx new file mode 100644 index 000000000000..e24d71690f2a --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/DatacentreCompute.spec.tsx @@ -0,0 +1,40 @@ +import { screen, waitFor } from '@testing-library/dom'; +import userEvent from '@testing-library/user-event'; +import { + checkTextVisibility, + DEFAULT_LISTING_ERROR, + labels, + renderTest, +} from '../../../../test-utils'; +import { datacentreList } from '../../../../../mocks/vcd-organization/vcd-datacentre.mock'; +import { organizationList } from '../../../../../mocks/vcd-organization/vcd-organization.mock'; +import { COMPUTE_TITLE } from '../DatacentreDashboard.constant'; +import { VHOSTS_TITLE } from '../compute/DatacentreCompute.constants'; + +describe('Datacentre Compute Listing Page', () => { + it('access and display compute listing page', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}`, + }); + + // access compute tab + await checkTextVisibility(COMPUTE_TITLE); + const tab = screen.getByText(COMPUTE_TITLE); + await waitFor(() => userEvent.click(tab)); + + // check page title & CTA + await checkTextVisibility(VHOSTS_TITLE); + await checkTextVisibility( + labels.datacentresCompute.managed_vcd_vdc_compute_order_cta, + ); + }); + + it('display an error', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/compute`, + isComputeKO: true, + }); + + await checkTextVisibility(DEFAULT_LISTING_ERROR); + }); +}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx index 6b019d6829ee..ddf7fceeb3fe 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx @@ -4,18 +4,28 @@ import DatacentreGenerationInformationTile from '@/components/tiles/datacentre-g import useManagedVcdOrganization from '@/data/hooks/useManagedVcdOrganization'; import { useManagedVcdDatacentre } from '@/data/hooks/useManagedVcdDatacentres'; import Loading from '@/components/loading/Loading.component'; +import Errors from '@/components/error/Error.component'; export default function DatacentresGeneralInformationPage() { const { id, vdcId } = useParams(); - const { data: vcdOrganization, isLoading } = useManagedVcdOrganization({ + const { + data: vcdOrganization, + isLoading: isLoadingVcd, + error: vcdError, + } = useManagedVcdOrganization({ id, }); const { data: vcdDatacentre, - isLoading: isLoadingVdc, + isLoading: isLoadingDatacentre, + error: datacentreError, } = useManagedVcdDatacentre(id, vdcId); - if (isLoading || isLoadingVdc) { + if (vcdError || datacentreError) { + return ; + } + + if (isLoadingVcd || isLoadingDatacentre) { return (
diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.spec.tsx new file mode 100644 index 000000000000..7147041d1471 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.spec.tsx @@ -0,0 +1,86 @@ +import userEvent from '@testing-library/user-event'; +import { screen, waitFor } from '@testing-library/react'; +import { + checkModalError, + checkModalVisibility, + labels, + mockEditInputValue, + renderTest, +} from '../../../../test-utils'; +import { organizationList } from '../../../../../mocks/vcd-organization/vcd-organization.mock'; +import { datacentreList } from '../../../../../mocks/vcd-organization/vcd-datacentre.mock'; +import { + DEFAULT_TIMEOUT, + mockSubmitNewValue, +} from '../../../../test-utils/uiTestHelpers'; + +const submitButtonLabel = + labels.dashboard.managed_vcd_dashboard_edit_modal_cta_edit; + +describe('Datacentre General Information Page', () => { + it('modify the description of the datacentre', async () => { + const { container } = await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}`, + }); + + await waitFor( + () => + expect( + screen.getByText(labels.datacentres.managed_vcd_vdc_vcpu_count), + ).toBeVisible(), + { timeout: DEFAULT_TIMEOUT }, + ); + + let editButton; + await waitFor( + () => { + editButton = screen.getByTestId('editIcon'); + return expect(editButton).toBeEnabled(); + }, + { timeout: DEFAULT_TIMEOUT }, + ); + + await waitFor(() => userEvent.click(editButton)); + await checkModalVisibility({ container, isVisible: true }); + + await mockSubmitNewValue({ submitButtonLabel }); + await checkModalVisibility({ container, isVisible: false }); + + expect( + screen.queryByText( + labels.dashboard.managed_vcd_dashboard_edit_description_modal_success, + ), + ).toBeVisible(); + }); + + it('display helper message when the input is invalid', async () => { + const { container } = await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/edit-description`, + }); + const expectedError = + labels.dashboard + .managed_vcd_dashboard_edit_description_modal_helper_error; + + await checkModalVisibility({ container, isVisible: true }); + + await mockEditInputValue(''); + await checkModalError({ container, error: expectedError }); + + await mockEditInputValue('a'.repeat(256)); + await checkModalError({ container, error: expectedError }); + }); + + it('display an error if update datacentre service is KO', async () => { + const { container } = await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/edit-description`, + isDatacentreUpdateKo: true, + }); + + await checkModalVisibility({ container, isVisible: true }); + + await mockSubmitNewValue({ submitButtonLabel }); + + await checkModalVisibility({ container, isVisible: true }); + await checkModalError({ container, error: 'Datacentre update error' }); + }); +}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/DatacentreStorageOrder.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/DatacentreStorageOrder.spec.tsx new file mode 100644 index 000000000000..6ea8f0606eb5 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/DatacentreStorageOrder.spec.tsx @@ -0,0 +1,59 @@ +import { screen, waitFor } from '@testing-library/dom'; +import userEvent from '@testing-library/user-event'; +import { + checkTextVisibility, + labels, + renderTest, +} from '../../../../test-utils'; +import { datacentreList } from '../../../../../mocks/vcd-organization/vcd-datacentre.mock'; +import { organizationList } from '../../../../../mocks/vcd-organization/vcd-organization.mock'; + +const orderCTA = labels.datacentresStorage.managed_vcd_vdc_storage_order_cta; +const orderTitle = labels.datacentresOrder.managed_vcd_vdc_order_storage_title; +const orderError = labels.datacentresOrder.managed_vcd_vdc_order_unavailable; + +describe('Datacentre Storage Order Page', () => { + it('access and display storage order page', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/storage`, + }); + + await checkTextVisibility(orderCTA); + const orderButton = screen.getByText(orderCTA); + await waitFor(() => userEvent.click(orderButton)); + + await checkTextVisibility(orderTitle); + }); + + it('display an error if orderableResource service is KO', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/storage/order`, + isOrderableResourceKO: true, + }); + await checkTextVisibility(orderError); + }); + + it('display an error if there is no orderableResource', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/storage/order`, + nbOrderableResource: 0, + }); + await checkTextVisibility(orderError); + }); + + it('display an error if catalog service is KO', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/storage/order`, + isCatalogKO: true, + }); + await checkTextVisibility(orderError); + }); + + it('display an error if there is no catalog products', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/storage/order`, + nbCatalogProduct: 0, + }); + await checkTextVisibility(orderError); + }); +}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage/DatacentreStorage.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage/DatacentreStorage.spec.tsx new file mode 100644 index 000000000000..40324d0c27f6 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage/DatacentreStorage.spec.tsx @@ -0,0 +1,39 @@ +import { screen, waitFor } from '@testing-library/dom'; +import userEvent from '@testing-library/user-event'; +import { + checkTextVisibility, + DEFAULT_LISTING_ERROR, + labels, + renderTest, +} from '../../../../test-utils'; +import { datacentreList } from '../../../../../mocks/vcd-organization/vcd-datacentre.mock'; +import { organizationList } from '../../../../../mocks/vcd-organization/vcd-organization.mock'; +import { STORAGE_TITLE } from '../DatacentreDashboard.constant'; + +describe('Datacentre Storage Listing Page', () => { + it('access and display storage listing page', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}`, + }); + + // access storage tab + await checkTextVisibility(STORAGE_TITLE); + const tab = screen.getByText(STORAGE_TITLE); + await waitFor(() => userEvent.click(tab)); + + // check page title & CTA + await checkTextVisibility(STORAGE_TITLE); + await checkTextVisibility( + labels.datacentresStorage.managed_vcd_vdc_storage_order_cta, + ); + }); + + it('display an error', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/storage`, + isStorageKO: true, + }); + + await checkTextVisibility(DEFAULT_LISTING_ERROR); + }); +}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx index 1f99d56cac88..15c81490486e 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx @@ -1,41 +1,20 @@ import userEvents from '@testing-library/user-event'; -import { screen, waitFor, fireEvent, within } from '@testing-library/react'; -import { renderTest, labels } from '../../../../test-utils'; +import { screen, waitFor } from '@testing-library/react'; +import { + renderTest, + labels, + checkModalVisibility, + mockSubmitNewValue, + checkModalError, + DEFAULT_TIMEOUT, +} from '../../../../test-utils'; import { organizationList } from '../../../../../mocks/vcd-organization/vcd-organization.mock'; -const changeInputAndSubmit = async () => { - const input = screen.getByLabelText('edit-input'); - const event = new CustomEvent('odsValueChange'); - Object.defineProperty(event, 'target', { value: { value: 'new name' } }); - await waitFor(() => fireEvent(input, event)); - - const modifyButton = screen.getByText( - labels.dashboard.managed_vcd_dashboard_edit_modal_cta_edit, - { exact: true }, - ); - - return waitFor(() => userEvents.click(modifyButton)); -}; - -const checkModal = async ({ - container, - isVisible, -}: { - container: HTMLElement; - isVisible: boolean; -}) => - waitFor( - () => { - const modal = container.querySelector('osds-modal'); - return isVisible - ? expect(modal).toBeInTheDocument() - : expect(modal).not.toBeInTheDocument(); - }, - { timeout: 30000 }, - ); +const submitButtonLabel = + labels.dashboard.managed_vcd_dashboard_edit_modal_cta_edit; describe('Organization General Information Page', () => { - it('modify the name of the company', async () => { + it('modify the name of the organization', async () => { const { container } = await renderTest({ initialRoute: `/${organizationList[1].id}`, }); @@ -47,7 +26,7 @@ describe('Organization General Information Page', () => { labels.dashboard.managed_vcd_dashboard_data_protection, ), ).toBeVisible(), - { timeout: 30000 }, + { timeout: DEFAULT_TIMEOUT }, ); let editButton; @@ -56,15 +35,15 @@ describe('Organization General Information Page', () => { editButton = screen.getAllByTestId('editIcon').at(0); return expect(editButton).not.toHaveAttribute('disabled'); }, - { timeout: 30000 }, + { timeout: DEFAULT_TIMEOUT }, ); await waitFor(() => userEvents.click(editButton)); - await checkModal({ container, isVisible: true }); + await checkModalVisibility({ container, isVisible: true }); - await changeInputAndSubmit(); + await mockSubmitNewValue({ submitButtonLabel }); - await checkModal({ container, isVisible: false }); + await checkModalVisibility({ container, isVisible: false }); expect( screen.queryByText( @@ -79,24 +58,15 @@ describe('Organization General Information Page', () => { isOrganizationUpdateKo: true, }); - await checkModal({ container, isVisible: true }); + await checkModalVisibility({ container, isVisible: true }); - await changeInputAndSubmit(); + await mockSubmitNewValue({ submitButtonLabel }); - await checkModal({ container, isVisible: true }); - - await waitFor( - () => - expect( - within( - container.querySelector('osds-modal') as HTMLElement, - ).getByText('Organization update error', { exact: false }), - ).toBeVisible(), - { timeout: 30000 }, - ); + await checkModalVisibility({ container, isVisible: true }); + await checkModalError({ container, error: 'Organization update error' }); }); - it('modify the description of the company', async () => { + it('modify the description of the organization', async () => { const { container } = await renderTest({ initialRoute: `/${organizationList[1].id}`, }); @@ -108,7 +78,7 @@ describe('Organization General Information Page', () => { labels.dashboard.managed_vcd_dashboard_data_protection, ), ).toBeVisible(), - { timeout: 30000 }, + { timeout: DEFAULT_TIMEOUT }, ); let editButton; @@ -117,15 +87,15 @@ describe('Organization General Information Page', () => { editButton = screen.getAllByTestId('editIcon').at(1); return expect(editButton).not.toHaveAttribute('disabled'); }, - { timeout: 30000 }, + { timeout: DEFAULT_TIMEOUT }, ); await waitFor(() => userEvents.click(editButton)); - await checkModal({ container, isVisible: true }); + await checkModalVisibility({ container, isVisible: true }); - await changeInputAndSubmit(); + await mockSubmitNewValue({ submitButtonLabel }); - await checkModal({ container, isVisible: false }); + await checkModalVisibility({ container, isVisible: false }); expect( screen.queryByText( @@ -140,20 +110,11 @@ describe('Organization General Information Page', () => { isOrganizationUpdateKo: true, }); - await checkModal({ container, isVisible: true }); + await checkModalVisibility({ container, isVisible: true }); - await changeInputAndSubmit(); + await mockSubmitNewValue({ submitButtonLabel }); - await checkModal({ container, isVisible: true }); - - await waitFor( - () => - expect( - within( - container.querySelector('osds-modal') as HTMLElement, - ).getByText('Organization update error', { exact: false }), - ).toBeVisible(), - { timeout: 30000 }, - ); + await checkModalVisibility({ container, isVisible: true }); + await checkModalError({ container, error: 'Organization update error' }); }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/datacentres.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/datacentres.spec.tsx new file mode 100644 index 000000000000..a18fcf9ee0ff --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/datacentres.spec.tsx @@ -0,0 +1,40 @@ +import { screen, waitFor } from '@testing-library/react'; +import { + checkTextVisibility, + DEFAULT_LISTING_ERROR, + labels, + renderTest, +} from '../../../test-utils'; +import { datacentreList } from '../../../../mocks/vcd-organization/vcd-datacentre.mock'; +import { organizationList } from '../../../../mocks/vcd-organization/vcd-organization.mock'; + +describe('Datacentres Listing Page', () => { + it('displays the virtual datacentres listing page', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres`, + }); + + await waitFor( + () => + expect( + screen.getByText(labels.datacentres.managed_vcd_vdc_title), + ).toBeVisible(), + { timeout: 30_000 }, + ); + + await waitFor(() => + expect( + screen.getByText(datacentreList[0].currentState.name), + ).toBeVisible(), + ); + }); + + it('display an error', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres`, + isDatacentresKo: true, + }); + + await checkTextVisibility(DEFAULT_LISTING_ERROR); + }); +}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/index.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/index.ts index 0b72d348bfc9..1304c9bc2038 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/index.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/index.ts @@ -1,2 +1,11 @@ export { renderTest } from './render-test'; export { labels } from './test-i18n'; +export { + DEFAULT_TIMEOUT, + DEFAULT_LISTING_ERROR, + checkTextVisibility, + mockEditInputValue, + mockSubmitNewValue, + checkModalVisibility, + checkModalError, +} from './uiTestHelpers'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/render-test.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/render-test.tsx index 1d58a246af9f..31babad64294 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/render-test.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/render-test.tsx @@ -19,6 +19,8 @@ import { getVeeamBackupMocks, getOrganizationMocks, GetOrganizationMocksParams, + getDatacentreOrderMocks, + GetDatacentreOrderMocksParams, GetVeeamBackupMocksParams, getIamMocks, } from '../../mocks'; @@ -35,6 +37,7 @@ export const renderTest = async ({ }: { initialRoute?: string; } & GetOrganizationMocksParams & + GetDatacentreOrderMocksParams & GetVeeamBackupMocksParams & GetServicesMocksParams = {}) => { ((global as unknown) as { server: SetupServer }).server?.resetHandlers( @@ -42,6 +45,7 @@ export const renderTest = async ({ ...getAuthenticationMocks({ isAuthMocked: true }), ...getVeeamBackupMocks(mockParams), ...getOrganizationMocks(mockParams), + ...getDatacentreOrderMocks(mockParams), ...getIamMocks(), ...getServicesMocks(mockParams), ]), diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/uiTestHelpers.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/uiTestHelpers.ts new file mode 100644 index 000000000000..9870fe869fa0 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/uiTestHelpers.ts @@ -0,0 +1,82 @@ +import '@testing-library/jest-dom'; +import userEvent from '@testing-library/user-event'; +import { + screen, + act, + waitFor, + fireEvent, + within, +} from '@testing-library/react'; +import { expect } from 'vitest'; + +export const DEFAULT_TIMEOUT = 30_000; +export const DEFAULT_LISTING_ERROR = 'An error occured while fetching data'; + +/** + * @description Standard check: wait and expect some text to be visible on the screen + * @param text expected to be visible + * @param timeout time to wait for + * @returns + */ +export const checkTextVisibility = ( + text: string, + timeout = DEFAULT_TIMEOUT, +): Promise => + waitFor(() => expect(screen.getByText(text)).toBeVisible(), { + timeout, + }); + +// Form helpers +export const mockEditInputValue = async (value: string) => { + const input = screen.getByLabelText('edit-input'); + const event = new CustomEvent('odsValueChange'); + Object.defineProperty(event, 'target', { value: { value } }); + await act(async () => waitFor(() => fireEvent(input, event))); +}; + +export const mockSubmitNewValue = async ({ + submitButtonLabel, + value = 'new value', +}: { + submitButtonLabel: string; + value?: string; +}) => { + await mockEditInputValue(value); + const submitButton = screen.getByText(submitButtonLabel, { exact: true }); + return waitFor(() => userEvent.click(submitButton)); +}; + +// Modal helpers +export const checkModalVisibility = ({ + container, + isVisible, +}: { + container: HTMLElement; + isVisible: boolean; +}): Promise => + waitFor( + () => { + const modal = container.querySelector('osds-modal'); + return isVisible + ? expect(modal).toBeInTheDocument() + : expect(modal).not.toBeInTheDocument(); + }, + { timeout: DEFAULT_TIMEOUT }, + ); + +export const checkModalError = ({ + container, + error, +}: { + container: HTMLElement; + error: string; +}): Promise => + waitFor( + () => + expect( + within(container.querySelector('osds-modal')).getByText(error, { + exact: false, + }), + ).toBeVisible(), + { timeout: DEFAULT_TIMEOUT }, + ); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-catalog.interface.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-catalog.interface.ts index 2e2541312b33..1964927281f3 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-catalog.interface.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-catalog.interface.ts @@ -1,32 +1,36 @@ import { Price } from '@ovh-ux/manager-module-order'; -export enum ProductPricingCapacity { - CONSUMPTION = 'consumption', - DETACH = 'detach', - DOWNGRADE = 'downgrade', - DYNAMIC = 'dynamic', - INSTALLATION = 'installation', - RENEW = 'renew', - UPGRADE = 'upgrade', -} -enum ProductPricingType { - CONSUMPTION = 'consumption', - PURCHASE = 'purchase', - RENTAL = 'rental', -} -enum CatalogProductType { - CLOUD_SERVICE = 'cloud_service', - DELIVERY = 'delivery', - DEPOSIT = 'deposit', - DOMAIN = 'domain', - IMPLEMENTATION_SERVICES = 'implementation_servies', - SAAS_LICENSE = 'saas_license', - SHIPPING = 'shipping', - STORAGE = 'storage', -} +type ObjectValues = T[keyof T]; + +const pricingCapacity = { + CONSUMPTION: 'consumption', + DETACH: 'detach', + DOWNGRADE: 'downgrade', + DYNAMIC: 'dynamic', + INSTALLATION: 'installation', + RENEW: 'renew', + UPGRADE: 'upgrade', +} as const; + +const productPricingType = { + CONSUMPTION: 'consumption', + PURCHASE: 'purchase', + RENTAL: 'rental', +} as const; + +const catalogProduct = { + CLOUD_SERVICE: 'cloud_service', + DELIVERY: 'delivery', + DEPOSIT: 'deposit', + DOMAIN: 'domain', + IMPLEMENTATION_SERVICES: 'implementation_servies', + SAAS_LICENSE: 'saas_license', + SHIPPING: 'shipping', + STORAGE: 'storage', +} as const; export interface IVcdCatalogProductPricing { - capacities: ProductPricingCapacity[]; + capacities: ObjectValues[]; description: string; duration: unknown; interval: number; @@ -37,14 +41,14 @@ export interface IVcdCatalogProductPricing { price: Price; priceInUcents: number; pricingMode: string; - pricingType: ProductPricingType; + pricingType: ObjectValues; } export interface IVcdCatalogProduct { family: string; planCode: string; productName: string; - productType: CatalogProductType; + productType: ObjectValues; prices: IVcdCatalogProductPricing[]; exclusive: boolean; mandatory: boolean; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/getPricedOrderableResource.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/getPricedOrderableResource.ts index 3ea1cd011e8d..f2c35bd7b6fd 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/getPricedOrderableResource.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/getPricedOrderableResource.ts @@ -2,10 +2,7 @@ import { IVdcOrderableResource, IVdcOrderableResourcePriced, } from '@/types/vcd-vdc-orderable-resource.interface'; -import { - ProductPricingCapacity, - TVcdCatalog, -} from '@/types/vcd-catalog.interface'; +import { TVcdCatalog } from '@/types/vcd-catalog.interface'; export const getVdcResourcePrice = (resource: IVdcOrderableResourcePriced) => resource.pricing?.priceInUcents; @@ -30,7 +27,7 @@ export const getPricedVdcResources = ({ ({ planCode }) => planCode === resource.profile, )?.prices; const pricing = prices?.find(({ capacities }) => - capacities.includes(ProductPricingCapacity.RENEW), + capacities.includes('renew'), ); return pricing ? [...list, { ...resource, pricing }] : list; }, [])