11import React from 'react' ;
22import { screen } from '@testing-library/react' ;
3+ import '@testing-library/jest-dom' ;
34import { rtlHelpers } from 'foremanReact/common/rtlTestHelpers' ;
45import { API } from 'foremanReact/redux/API' ;
56import { 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