@@ -137,7 +137,7 @@ describe('features/classification/Classification', () => {
137137 } ) ;
138138
139139 const modifiedByClassificationLabel = screen . getByText ( messages . modifiedByLabel . defaultMessage ) ;
140- const modifiedByDetailsSection = screen . getByTestId ( 'classification-modifiedby' ) ;
140+ const modifiedByDetailsSection = screen . queryByTestId ( 'classification-modifiedby' ) ;
141141 const messageText = screen . getByText ( expectedMessageText ) ;
142142 const appliedByTitle = screen . queryByText ( messages . appliedByTitle . defaultMessage ) ;
143143
@@ -235,7 +235,7 @@ describe('features/classification/Classification', () => {
235235
236236 test . each ( [ true , false , undefined ] ) (
237237 'should render AI reasoning with expected label when provided aiClassificationReason prop regardless of shouldUseAppliedByLabels value: %s' ,
238- shouldUseAppliedByLabels => {
238+ async shouldUseAppliedByLabels => {
239239 const expectedCitationsCount = 5 ;
240240 const expectedCitations = Array . from ( { length : expectedCitationsCount } , ( ) => ( {
241241 content : 'file content for citation' ,
@@ -257,7 +257,8 @@ describe('features/classification/Classification', () => {
257257 shouldUseAppliedByLabels,
258258 } ) ;
259259
260- const boxAiIcon = screen . getByTestId ( 'box-ai-icon' ) ;
260+ // Wait for the async component to load
261+ const boxAiIcon = await screen . findByTestId ( 'box-ai-icon' ) ;
261262 const appliedByTitle = screen . getByText ( messages . appliedByTitle . defaultMessage ) ;
262263 const appliedByDetails = screen . getByText ( 'Box AI on January 15, 2024' ) ; // expected text based on provided mocks
263264 const reasonText = screen . getByText ( aiClassificationReason . answer ) ;
@@ -284,7 +285,7 @@ describe('features/classification/Classification', () => {
284285 modifiedBy,
285286 } ) ;
286287
287- const modifiedByDetailsSection = screen . getByTestId ( 'classification-modifiedby' ) ;
288+ const modifiedByDetailsSection = screen . queryByTestId ( 'classification-modifiedby' ) ;
288289 const appliedByTitle = screen . getByText ( messages . appliedByTitle . defaultMessage ) ;
289290 const appliedByDetails = screen . getByText ( 'TestUser on January 15, 2024' ) ;
290291 const modifiedByClassificationLabel = screen . queryByText ( messages . modifiedByLabel . defaultMessage ) ;
@@ -307,7 +308,7 @@ describe('features/classification/Classification', () => {
307308 modifiedBy,
308309 } ) ;
309310
310- const modifiedByDetailsSection = screen . getByTestId ( 'classification-modifiedby' ) ;
311+ const modifiedByDetailsSection = screen . queryByTestId ( 'classification-modifiedby' ) ;
311312 const appliedByTitle = screen . getByText ( messages . appliedByTitle . defaultMessage ) ;
312313 const appliedByDetails = screen . getByText ( 'TestUser on January 15, 2024' ) ;
313314 const modifiedByClassificationLabel = screen . queryByText ( messages . modifiedByLabel . defaultMessage ) ;
0 commit comments