Skip to content

Commit

Permalink
fix(hycu): build
Browse files Browse the repository at this point in the history
  ref: MANAGER-14504

Signed-off-by: Thibaud Crespin <[email protected]>
  • Loading branch information
Thibaud Crespin committed Oct 22, 2024
1 parent 98c85f4 commit 9ad37a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export type OrderCatalogProps = {

export const useOrderCatalogHYCU = (
ovhSubsidiary: OvhSubsidiary,
options: Partial<DefinedInitialDataOptions<HYCUCatalog, ApiError>> = {},
options: Partial<DefinedInitialDataOptions<HYCUCatalog, ApiError>> & {
keepPreviousData?: boolean;
} = {},
) => {
return useQuery<HYCUCatalog, ApiError>({
queryKey: ['order/catalog/public/licenseHycu', ovhSubsidiary],
Expand Down
18 changes: 10 additions & 8 deletions packages/manager/apps/hycu/src/hooks/order/useOrderHYCU.spec.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import { describe, expect, it, test, vi } from 'vitest';
import { renderHook } from '@testing-library/react';
import { OvhSubsidiary } from '@ovh-ux/manager-react-components';
import useOrderHYCU from './useOrderHYCU';

vi.mock('@ovh-ux/manager-module-order', () => ({
useOrderURL: () => 'http://test',
useOrderURL: () => 'https://test',
getHYCUProductSettings: () => 'test-settings',
}));

describe('get hycu express order linl ', () => {
const useCases: {
planCode: string;
region: string;
region: OvhSubsidiary;
}[] = [
{
planCode: 'hycu-cloud-vm-pack-25',
region: 'FR',
region: OvhSubsidiary.FR,
},
{
planCode: 'hycu-cloud-vm-pack-250',
region: 'US',
region: OvhSubsidiary.US,
},
];
test.each(useCases)(
Expand All @@ -29,16 +30,17 @@ describe('get hycu express order linl ', () => {
const { result } = renderHook(() => useOrderHYCU({ planCode, region }));
// then
expect(result.current.orderLink).toContain(
'http://test?products=~(test-settings)',
'https://test?products=~(test-settings)',
);
},
);
it('should return null if planCode is not defined', () => {
// given
const planCode = undefined;
const region = 'FR';
const region = OvhSubsidiary.FR;
// when
const { result } = renderHook(() => useOrderHYCU({ planCode, region }));
const { result } = renderHook(() =>
useOrderHYCU({ planCode: null, region }),
);

// then
expect(result.current.orderLink).toBeNull();
Expand Down

0 comments on commit 9ad37a9

Please sign in to comment.