File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -294,4 +294,35 @@ describe('CollectionHeader [Component]', function () {
294294      } ) ; 
295295    } ) ; 
296296  } ) ; 
297+ 
298+   it ( 'should handle undefined schemaAnalysis gracefully and render collection header successfully' ,  function  ( )  { 
299+     // Create a store with undefined schemaAnalysis to simulate initial state 
300+     const  mockStoreWithUndefinedSchema  =  createStore ( ( )  =>  ( { 
301+       mockDataGenerator : { 
302+         isModalOpen : false , 
303+         currentStep : MockDataGeneratorStep . SCHEMA_CONFIRMATION , 
304+       } , 
305+       // schemaAnalysis not provided 
306+     } ) ) ; 
307+ 
308+     expect ( ( )  =>  { 
309+       renderWithConnections ( 
310+         < Provider  store = { mockStoreWithUndefinedSchema } > 
311+           < WorkspacesServiceProvider  value = { { }  as  WorkspacesService } > 
312+             < CollectionHeader 
313+               isAtlas = { false } 
314+               isReadonly = { false } 
315+               isTimeSeries = { false } 
316+               isClustered = { false } 
317+               isFLE = { false } 
318+               namespace = "test.test" 
319+             /> 
320+           </ WorkspacesServiceProvider > 
321+         </ Provider > 
322+       ) ; 
323+     } ) . to . not . throw ( ) ; 
324+ 
325+     expect ( screen . getByTestId ( 'collection-header' ) ) . to . exist ; 
326+     expect ( screen . getByTestId ( 'collection-header-actions' ) ) . to . exist ; 
327+   } ) ; 
297328} ) ; 
Original file line number Diff line number Diff line change @@ -194,10 +194,12 @@ const mapStateToProps = (state: CollectionState) => {
194194
195195  return  { 
196196    hasData :
197+       schemaAnalysis  && 
197198      schemaAnalysis . status  ===  SCHEMA_ANALYSIS_STATE_COMPLETE  && 
198199      schemaAnalysis . processedSchema  && 
199200      Object . keys ( schemaAnalysis . processedSchema ) . length  >  0 , 
200201    maxNestingDepth :
202+       schemaAnalysis  && 
201203      schemaAnalysis . status  ===  SCHEMA_ANALYSIS_STATE_COMPLETE  && 
202204      schemaAnalysis . schemaMetadata 
203205        ? schemaAnalysis . schemaMetadata . maxNestingDepth 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments