foreman_rh_cloud 13.0.5 → 13.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +47 -26
- data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +46 -25
- data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +32 -11
- data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +46 -25
- data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +46 -25
- data/lib/foreman_rh_cloud/engine.rb +0 -21
- data/lib/foreman_rh_cloud/plugin.rb +1 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/locale/foreman_rh_cloud.pot +55 -18
- data/locale/fr/foreman_rh_cloud.po +48 -27
- data/locale/ja/foreman_rh_cloud.po +47 -26
- data/locale/ka/foreman_rh_cloud.po +32 -11
- data/locale/ko/foreman_rh_cloud.po +47 -26
- data/locale/zh_CN/foreman_rh_cloud.po +47 -26
- data/package.json +1 -1
- data/webpack/InsightsVulnerabilityHostIndexExtensions/CVECountCell.js +8 -2
- data/webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js +48 -2
- metadata +1 -1
@@ -2,8 +2,11 @@ import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
3
3
|
import { API } from 'foremanReact/redux/API';
|
4
4
|
import { CVECountCell } from '../CVECountCell';
|
5
|
+
import * as ConfigHooks from '../../common/Hooks/ConfigHooks';
|
5
6
|
|
6
7
|
jest.mock('foremanReact/redux/API');
|
8
|
+
jest.mock('../../common/Hooks/ConfigHooks');
|
9
|
+
|
7
10
|
API.get.mockImplementation(async () => ({
|
8
11
|
data: [
|
9
12
|
{
|
@@ -14,15 +17,58 @@ API.get.mockImplementation(async () => ({
|
|
14
17
|
],
|
15
18
|
}));
|
16
19
|
|
20
|
+
const hostDetailsMock = {
|
21
|
+
name: 'test-host.example.com',
|
22
|
+
subscription_facet_attributes: {
|
23
|
+
uuid: 'test-uuid-123',
|
24
|
+
},
|
25
|
+
};
|
26
|
+
|
17
27
|
describe('CVECountCell', () => {
|
18
|
-
|
19
|
-
|
28
|
+
beforeEach(() => {
|
29
|
+
ConfigHooks.useAdvisorEngineConfig.mockReturnValue(true);
|
30
|
+
});
|
31
|
+
|
32
|
+
afterEach(() => {
|
33
|
+
jest.clearAllMocks();
|
34
|
+
});
|
35
|
+
|
36
|
+
it('renders an empty cves count column when no subscription UUID', () => {
|
37
|
+
const hostDetailsMockIoP = {
|
20
38
|
name: 'test-host.example.com',
|
21
39
|
subscription_facet_attributes: {
|
22
40
|
uuid: null, // no subscription
|
23
41
|
},
|
24
42
|
};
|
43
|
+
render(<CVECountCell hostDetails={hostDetailsMockIoP} />);
|
44
|
+
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
|
45
|
+
});
|
46
|
+
|
47
|
+
it('renders UnknownIcon when IoP is not enabled', () => {
|
48
|
+
ConfigHooks.useAdvisorEngineConfig.mockReturnValue(false);
|
49
|
+
render(<CVECountCell hostDetails={hostDetailsMock} />);
|
50
|
+
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
|
51
|
+
expect(ConfigHooks.useAdvisorEngineConfig).toHaveBeenCalled();
|
52
|
+
});
|
53
|
+
|
54
|
+
it('renders UnknownIcon when IoP is enabled but CVE API call fails', () => {
|
55
|
+
// Mock successful IoP config
|
56
|
+
ConfigHooks.useAdvisorEngineConfig.mockReturnValue(true);
|
57
|
+
// Mock CVE API failure - override the global mock for this test
|
58
|
+
API.get.mockImplementationOnce(async () => {
|
59
|
+
throw new Error('CVE API call failed');
|
60
|
+
});
|
61
|
+
|
62
|
+
render(<CVECountCell hostDetails={hostDetailsMock} />);
|
63
|
+
// Should render UnknownIcon when CVE API fails
|
64
|
+
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
|
65
|
+
expect(ConfigHooks.useAdvisorEngineConfig).toHaveBeenCalled();
|
66
|
+
});
|
67
|
+
|
68
|
+
it('renders UnknownIcon when IoP is undefined (API call pending)', () => {
|
69
|
+
ConfigHooks.useAdvisorEngineConfig.mockReturnValue(undefined);
|
25
70
|
render(<CVECountCell hostDetails={hostDetailsMock} />);
|
26
71
|
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
|
72
|
+
expect(ConfigHooks.useAdvisorEngineConfig).toHaveBeenCalled();
|
27
73
|
});
|
28
74
|
});
|