Skip to content

Commit de9614f

Browse files
erazafimovhstif59100
authored andcommitted
fix(web-hosting): fix tests
ref: #PUWEBPT-86 Signed-off-by: Emilien Razafimampiandra <[email protected]>
1 parent e409516 commit de9614f

File tree

56 files changed

+520
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+520
-288
lines changed

packages/manager/apps/web-hosting/src/components/badgeStatus/BadgeStatus.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const BadgeStatus: React.FC<BadgeStatusProps> = ({
7070
}}
7171
data-testid={`badge-status-${itemStatus}`}
7272
color={statusColor}
73-
className="mr-4 cursor-pointer inline-block"
73+
className="mr-4 inline-block cursor-pointer"
7474
isLoading={isLoading}
7575
>
7676
{label || t(`web_hosting_status_${itemStatus.toLowerCase()}`)}

packages/manager/apps/web-hosting/src/components/loading/Loading.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { SPINNER_SIZE, Spinner } from '@ovhcloud/ods-react';
22

33
export default function Loading() {
44
return (
5-
<div data-testid="spinner" className="flex justify-center my-5">
5+
<div data-testid="spinner" className="my-5 flex justify-center">
66
<Spinner size={SPINNER_SIZE.md} inline-block></Spinner>
77
</div>
88
);

packages/manager/apps/web-hosting/src/components/topBar/TopBar.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default function Topbar() {
6464
label: it?.currentState?.fqdn,
6565
})) || [];
6666
return (
67-
<div className="flex flex-col space-y-10 mb-10">
67+
<div className="mb-10 flex flex-col space-y-10">
6868
<div className="flex space-x-4">
6969
<Button
7070
size={BUTTON_SIZE.sm}

packages/manager/apps/web-hosting/src/components/topBar/TopBar.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { ComponentType } from 'react';
22

3-
import '@testing-library/jest-dom';
43
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
4+
import '@testing-library/jest-dom';
55
import { render, screen } from '@testing-library/react';
66
import { I18nextProvider } from 'react-i18next';
77
import { describe, it } from 'vitest';

packages/manager/apps/web-hosting/src/hooks/ssl/useDatagridColumn.spec.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import { renderHook } from '@testing-library/react';
55
import { I18nextProvider } from 'react-i18next';
66
import { describe, it } from 'vitest';
77

8-
import { createWrapper, i18n } from '@/utils/test.provider';
9-
108
import useDatagridColumn from '@/hooks/ssl/useDatagridColumn';
9+
import { createWrapper, i18n } from '@/utils/test.provider';
1110

1211
const testQueryClient = new QueryClient({
1312
defaultOptions: {

packages/manager/apps/web-hosting/src/pages/dashboard/OrderDomain.page.spec.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
import React, { ComponentType } from 'react';
22

3+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
34
import { fireEvent, render, screen } from '@testing-library/react';
5+
import { I18nextProvider } from 'react-i18next';
46
import { beforeEach, describe, expect, it, vi } from 'vitest';
57

8+
import { createWrapper, i18n } from '@/utils/test.provider';
69
import { navigate } from '@/utils/test.setup';
7-
import { createTestWrapper } from '@/utils/test.provider';
810

911
import OrderDomainModal from './OrderDomain.page';
1012

11-
const Wrappers = createTestWrapper();
13+
const testQueryClient = new QueryClient({
14+
defaultOptions: {
15+
mutations: {
16+
retry: false,
17+
},
18+
queries: {
19+
retry: false,
20+
},
21+
},
22+
});
23+
24+
const RouterWrapper = createWrapper();
25+
26+
const Wrappers = ({ children }: { children: React.ReactElement }) => {
27+
return (
28+
<RouterWrapper>
29+
<QueryClientProvider client={testQueryClient}>
30+
<I18nextProvider i18n={i18n}>{children}</I18nextProvider>
31+
</QueryClientProvider>
32+
</RouterWrapper>
33+
);
34+
};
1235

1336
vi.mock('@/constants', async (importActual) => {
1437
const actual = await importActual<typeof import('@/constants')>();

packages/manager/apps/web-hosting/src/pages/dashboard/OrderDomain.page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ export default function OrderDomainModal() {
5858
onClick: closeModal,
5959
}}
6060
>
61-
<div className="flex flex-col space-y-8 mb-10">
61+
<div className="mb-10 flex flex-col space-y-8">
6262
<Text className="mb-4" preset={TEXT_PRESET.heading4}>
6363
{t('hosting_dashboard_add_or_order_title')}
6464
</Text>
6565
<Text>{t('hosting_dashboard_add_or_order_step1_title')}</Text>
66-
<div className="flex gap-4 items-center">
66+
<div className="flex items-center gap-4">
6767
<RadioGroup>
6868
<Radio
6969
value={ACTIONS.ORDER}

packages/manager/apps/web-hosting/src/pages/dashboard/layout.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ export default function Layout() {
210210

211211
return (
212212
<BaseLayout breadcrumb={<Breadcrumb />}>
213-
<div className="flex items-center justify-between mt-10">
213+
<div className="mt-10 flex items-center justify-between">
214214
{editDisplayName ? (
215-
<div className="w-2/3 mb-4">
215+
<div className="mb-4 w-2/3">
216216
<Input
217217
className="w-2/3"
218218
name="edit-detail"
@@ -242,14 +242,14 @@ export default function Layout() {
242242
</Button>
243243
</div>
244244
)}
245-
<div className="flex flex-wrap gap-5 justify-end">
245+
<div className="flex flex-wrap justify-end gap-5">
246246
<ChangelogMenu links={CHANGELOG_LINKS} />
247247
<GuideMenu items={guideItems} />
248248
</div>
249249
</div>
250250
{!isOverridedPage && (
251251
<>
252-
<div className="flex items-center justify-between mb-7">
252+
<div className="mb-7 flex items-center justify-between">
253253
<Text>{data?.serviceName}</Text>
254254
<div className="flex flex-wrap justify-end">
255255
<ActionMenu
@@ -279,7 +279,7 @@ export default function Layout() {
279279
</Message>
280280
)}
281281
<Notifications />
282-
<div className=" mt-8 mb-6">
282+
<div className=" mb-6 mt-8">
283283
<Tabs withArrows defaultValue={tabs[0].name}>
284284
<TabList>
285285
{tabs.map((tab: DashboardTab) => (

packages/manager/apps/web-hosting/src/pages/dashboard/local-seo/manage/RemoveSeoSubscription.page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,24 @@ export default function RemoveSeoSubscriptionModal() {
6262
onClick: closeModal,
6363
}}
6464
>
65-
<div className="flex flex-col space-y-8 mb-10 mt-5">
65+
<div className="mb-10 mt-5 flex flex-col space-y-8">
6666
<Text>{t('hosting_tab_LOCAL_SEO_delete_confirm')}</Text>
6767
<div className="flex">
68-
<Text preset={TEXT_PRESET.heading6} className="w-1/2 text-right pr-4">
68+
<Text preset={TEXT_PRESET.heading6} className="w-1/2 pr-4 text-right">
6969
{t('hosting_tab_LOCAL_SEO_table_header_name')}
7070
</Text>
7171
<Text className="w-1/2">{companyName}</Text>
7272
</div>
7373
<div className="flex">
74-
<Text preset={TEXT_PRESET.heading6} className="w-1/2 text-right pr-4">
74+
<Text preset={TEXT_PRESET.heading6} className="w-1/2 pr-4 text-right">
7575
{t('hosting_tab_LOCAL_SEO_table_header_address')}
7676
</Text>
7777
<Text className="w-1/2">
7878
{address || t('hosting_tab_LOCAL_SEO_table_value_undefined')}
7979
</Text>
8080
</div>
8181
<div className="flex">
82-
<Text preset={TEXT_PRESET.heading6} className="w-1/2 text-right pr-4">
82+
<Text preset={TEXT_PRESET.heading6} className="w-1/2 pr-4 text-right">
8383
{t('hosting_tab_LOCAL_SEO_table_header_email')}
8484
</Text>
8585
<Text className="w-1/2">{email}</Text>

packages/manager/apps/web-hosting/src/pages/dashboard/multisite/__tests__/Multisite.page.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ vi.mock('@/data/hooks/webHosting/webHostingWebsiteDomain/webHostingWebsiteDomain
4747
isLoading: false,
4848
refetch: vi.fn(),
4949
}),
50+
useWebHostingWebsiteDomains: vi.fn().mockReturnValue([
51+
{
52+
data: WebHostingWebsiteDomainMocks,
53+
isLoading: false,
54+
refetch: vi.fn(),
55+
},
56+
]),
5057
}));
5158

5259
describe('MultisitePage component', () => {

0 commit comments

Comments
 (0)