Skip to content

Commit 7263a51

Browse files
author
achraf hafedh
committed
feat(hub): add fix and verrify html tests
ref: #MANAGER-20181 Signed-off-by: achraf hafedh <[email protected]>
1 parent 3cf2231 commit 7263a51

File tree

22 files changed

+357
-2
lines changed

22 files changed

+357
-2
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { RoadmapChangelogItem } from '@/types/roadmapchangelog.type';
2+
3+
export const roadmapItem: RoadmapChangelogItem = {
4+
title: 'title',
5+
url: 'url',
6+
product: 'product',
7+
releaseDate: 'releaseDate',
8+
status: 'status',
9+
changelog: 'changelog',
10+
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { render } from '@testing-library/react';
2+
import { describe, expect, it } from 'vitest';
3+
4+
import { FourServices } from '@/__mocks__/billingServices';
5+
6+
import BillingStatus from './BillingStatus.component';
7+
8+
describe('BillingStatus W3C Validation', () => {
9+
const [
10+
serviceResiliated,
11+
serviceWithManualRenewNotResiliatedWithoutDebt,
12+
serviceOneShotWithoutResiliation,
13+
serviceWithoutUrlAndSuspendedBilling,
14+
] = FourServices.services;
15+
16+
it('should have a valid html for service Resiliated', () => {
17+
const { container } = render(<BillingStatus service={serviceResiliated} />);
18+
const html = container.innerHTML;
19+
20+
expect(html).toBeValidHtml();
21+
});
22+
23+
it('should have a valid html for service With Manual Renew Not ResiliatedWithoutDebt', () => {
24+
const { container } = render(
25+
<BillingStatus service={serviceWithManualRenewNotResiliatedWithoutDebt} />,
26+
);
27+
const html = container.innerHTML;
28+
29+
expect(html).toBeValidHtml();
30+
});
31+
32+
it('should have a valid html for service OneSho tWithout Resiliation', () => {
33+
const { container } = render(<BillingStatus service={serviceOneShotWithoutResiliation} />);
34+
const html = container.innerHTML;
35+
36+
expect(html).toBeValidHtml();
37+
});
38+
39+
it('should have a valid html for service Without Url And Suspended Billing', () => {
40+
const { container } = render(<BillingStatus service={serviceWithoutUrlAndSuspendedBilling} />);
41+
const html = container.innerHTML;
42+
43+
expect(html).toBeValidHtml();
44+
});
45+
});
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { describe, expect, it, vi } from 'vitest';
2+
3+
import { ShellContextType } from '@ovh-ux/manager-react-shell-client';
4+
import * as reactShellClientModule from '@ovh-ux/manager-react-shell-client';
5+
6+
import { renderWithShellContext } from '@/__mocks__/ShellContextWrapper';
7+
import { FourServices } from '@/__mocks__/billingServices';
8+
9+
import ServicesActions from './ServicesActions.component';
10+
11+
const [serviceResiliated] = FourServices.services;
12+
const autoRenewLink = 'https://www.autorenewlink.com/';
13+
const trackingPrefix = ['a tracking prefix'];
14+
15+
const trackingSpy = vi.fn();
16+
17+
const shellContext = {
18+
shell: { navigation: {} },
19+
environment: {
20+
user: { ovhSubsidiary: 'FR' },
21+
},
22+
};
23+
24+
const renderComponent = () =>
25+
renderWithShellContext(
26+
<ServicesActions
27+
service={serviceResiliated}
28+
autoRenewLink={autoRenewLink}
29+
trackingPrefix={trackingPrefix}
30+
/>,
31+
shellContext as ShellContextType,
32+
);
33+
34+
vi.mock('@ovh-ux/manager-react-shell-client', async (importOriginal) => {
35+
const original: typeof reactShellClientModule = await importOriginal();
36+
return {
37+
...original,
38+
useOvhTracking: () => ({
39+
trackClick: trackingSpy,
40+
}),
41+
};
42+
});
43+
44+
describe('ServicesActions W3C Validation', () => {
45+
it('should have a valid html for service Resiliated', () => {
46+
const { container } = renderComponent();
47+
48+
expect(container.innerHTML).toBeValidHtml();
49+
});
50+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { render } from '@testing-library/react';
2+
import { describe, expect, it } from 'vitest';
3+
4+
import Loading from './Loading';
5+
6+
describe('Loading Component', () => {
7+
it('should have a valid html', () => {
8+
const { container } = render(<Loading />);
9+
const html = container.innerHTML;
10+
11+
expect(html).toBeValidHtml();
12+
});
13+
});

packages/manager/apps/hub/src/components/banner/Banner.spec.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ describe('Banner.component', () => {
5858
alt: 'Summit Banner',
5959
images: {
6060
default: {
61-
src: 'data:image/jpeg;base64,....',
61+
src: 'url',
6262
width: 1250,
6363
height: 117,
6464
},
6565
responsive: {
66-
src: 'data:image/jpeg;base64,....',
66+
src: 'url',
6767
width: 453,
6868
height: 117,
6969
},
@@ -86,4 +86,11 @@ describe('Banner.component', () => {
8686

8787
expect(trackingSpy).toHaveBeenCalled();
8888
});
89+
90+
it('should have a valid html', () => {
91+
const { container } = renderComponent();
92+
const html = container.innerHTML;
93+
94+
expect(html).toBeValidHtml();
95+
});
8996
});

packages/manager/apps/hub/src/components/hub-order-tracking/HubOrderTracking.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,11 @@ describe('HubOrderTracking Component', async () => {
151151
expect(screen.getByText('order_tracking_history_custom_payment_waiting')).toBeInTheDocument();
152152
});
153153
});
154+
155+
it('should have a valid html', () => {
156+
const { container } = renderComponent(<HubOrderTracking />);
157+
const html = container.innerHTML;
158+
159+
expect(html).toBeValidHtml();
160+
});
154161
});

packages/manager/apps/hub/src/components/hub-support/HubSupport.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,11 @@ describe('HubSupport Component', () => {
142142
const helpHubSupport = screen.getByTestId('tile-error');
143143
expect(helpHubSupport).toBeInTheDocument();
144144
});
145+
146+
it('should have a valid html', () => {
147+
const { container } = render(<HubSupport />);
148+
const html = container.innerHTML;
149+
150+
expect(html).toBeValidHtml();
151+
});
145152
});

packages/manager/apps/hub/src/components/hub-support/hub-support-help/HubSupportHelp.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,11 @@ describe('HubSupportHelp Component', () => {
5050
actions: ['activity', 'assistance', 'guide-welcome', 'go-to-docs'],
5151
});
5252
});
53+
54+
it('should have a valid html', () => {
55+
const { container } = render(<HubSupportHelp />);
56+
const html = container.innerHTML;
57+
58+
expect(html).toBeValidHtml();
59+
});
5360
});

packages/manager/apps/hub/src/components/roadmap-changelog-datagrid/RoadmapChangelogDatagrids.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,11 @@ describe('Roadmap Changelog Datagrids', () => {
9090

9191
expect(screen.getByText('Jan 15, 2025')).toBeInTheDocument();
9292
});
93+
94+
it('should have a valid html', () => {
95+
const { container } = renderComponent();
96+
const html = container.innerHTML;
97+
98+
expect(html).toBeValidHtml();
99+
});
93100
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { render } from '@testing-library/react';
2+
import { describe, expect, it } from 'vitest';
3+
4+
import { roadmapItem } from '@/__mocks__/roadmap';
5+
6+
import { RoadmapChangelogItemDescriptionCell } from './RoadmapChangelogItemDescriptionCell';
7+
8+
describe('RoadmapChangelogItemDescriptionCell Component', () => {
9+
it('should have a valid html', () => {
10+
const { container } = render(<RoadmapChangelogItemDescriptionCell item={roadmapItem} />);
11+
const html = container.innerHTML;
12+
13+
expect(html).toBeValidHtml();
14+
});
15+
});

0 commit comments

Comments
 (0)