Skip to content

Commit e028c06

Browse files
committed
fix tests
1 parent 7b561ea commit e028c06

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import { screen } from '@testing-library/react';
3+
import '@testing-library/jest-dom';
34
import { rtlHelpers } from 'foremanReact/common/rtlTestHelpers';
45
import { API } from 'foremanReact/redux/API';
56
import { CVECountCell } from '../CVECountCell';
@@ -54,10 +55,10 @@ describe('CVECountCell', () => {
5455
},
5556
},
5657
});
57-
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
58+
expect(screen.getByText('—')).toBeInTheDocument();
5859
});
5960

60-
it('renders UnknownIcon when IoP is not enabled', () => {
61+
it('renders when IoP is not enabled', () => {
6162
renderWithStore(<CVECountCell hostDetails={hostDetailsMock} />, {
6263
router: {
6364
location: {
@@ -74,10 +75,10 @@ describe('CVECountCell', () => {
7475
},
7576
},
7677
});
77-
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
78+
expect(screen.getByText('—')).toBeInTheDocument();
7879
});
7980

80-
it('renders UnknownIcon when IoP is enabled but CVE API call fails', () => {
81+
it('renders when IoP is enabled but CVE API call fails', () => {
8182
// Mock CVE API failure - override the global mock for this test
8283
API.get.mockImplementationOnce(async () => {
8384
throw new Error('CVE API call failed');
@@ -105,10 +106,10 @@ describe('CVECountCell', () => {
105106
},
106107
});
107108
// Should render UnknownIcon when CVE API fails
108-
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
109+
expect(screen.getByText('—')).toBeInTheDocument();
109110
});
110111

111-
it('renders UnknownIcon when IoP is undefined (API call pending)', () => {
112+
it('renders when IoP is undefined (API call pending)', () => {
112113
renderWithStore(<CVECountCell hostDetails={hostDetailsMock} />, {
113114
router: {
114115
location: {
@@ -124,6 +125,6 @@ describe('CVECountCell', () => {
124125
},
125126
},
126127
});
127-
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
128+
expect(screen.getByText('—')).toBeInTheDocument();
128129
});
129130
});

0 commit comments

Comments
 (0)