@@ -164,7 +164,6 @@ const renderIndexList = (
164164 rollingIndexes = { [ ] }
165165 serverVersion = "4.4.0"
166166 isWritable = { true }
167- readOnly = { false }
168167 onHideIndexClick = { ( ) => { } }
169168 onUnhideIndexClick = { ( ) => { } }
170169 onDeleteIndexClick = { ( ) => { } }
@@ -185,12 +184,12 @@ const indexFields = [
185184 'indexes-actions-field' ,
186185] ;
187186
188- describe ( 'RegularIndexesTable Component' , function ( ) {
187+ describe . only ( 'RegularIndexesTable Component' , function ( ) {
189188 before ( cleanup ) ;
190189 afterEach ( cleanup ) ;
191190
192191 it ( 'renders regular indexes' , function ( ) {
193- renderIndexList ( { isWritable : true , readOnly : false , indexes : indexes } ) ;
192+ renderIndexList ( { isWritable : true , indexes : indexes } ) ;
194193
195194 const indexesList = screen . getByTestId ( 'indexes-list' ) ;
196195 expect ( indexesList ) . to . exist ;
@@ -260,7 +259,6 @@ describe('RegularIndexesTable Component', function () {
260259 it ( 'renders in-progress indexes' , function ( ) {
261260 renderIndexList ( {
262261 isWritable : true ,
263- readOnly : false ,
264262 inProgressIndexes : inProgressIndexes ,
265263 } ) ;
266264
@@ -287,7 +285,6 @@ describe('RegularIndexesTable Component', function () {
287285 it ( 'renders rolling indexes' , function ( ) {
288286 renderIndexList ( {
289287 isWritable : true ,
290- readOnly : false ,
291288 rollingIndexes : rollingIndexes ,
292289 } ) ;
293290
@@ -342,7 +339,6 @@ describe('RegularIndexesTable Component', function () {
342339 // index if it didn't also exist as a rolling index
343340 renderIndexList ( {
344341 isWritable : true ,
345- readOnly : false ,
346342 indexes : indexesWithRollingIndex ,
347343 } ) ;
348344
@@ -358,7 +354,6 @@ describe('RegularIndexesTable Component', function () {
358354 // up as a regular index too
359355 renderIndexList ( {
360356 isWritable : true ,
361- readOnly : false ,
362357 indexes : indexesWithRollingIndex ,
363358 rollingIndexes,
364359 } ) ;
@@ -371,7 +366,6 @@ describe('RegularIndexesTable Component', function () {
371366 it ( 'does not render the list if there is an error' , function ( ) {
372367 renderIndexList ( {
373368 isWritable : true ,
374- readOnly : false ,
375369 indexes : indexes ,
376370 error : 'moo' ,
377371 } ) ;
@@ -382,39 +376,32 @@ describe('RegularIndexesTable Component', function () {
382376 } ) ;
383377
384378 it ( 'renders the delete and hide/unhide button when a user can modify indexes' , function ( ) {
385- renderIndexList ( { isWritable : true , readOnly : false , indexes : indexes } ) ;
379+ renderIndexList ( { isWritable : true , indexes : indexes } ) ;
386380 const indexesList = screen . getByTestId ( 'indexes-list' ) ;
387381 expect ( indexesList ) . to . exist ;
388382 indexes . forEach ( ( index ) => {
389383 const indexRow = screen . getByTestId ( `indexes-row-${ index . name } ` ) ;
390- expect ( within ( indexRow ) . getByTestId ( 'indexes-actions-field' ) ) . to . exist ;
384+ const buttons = within ( indexRow )
385+ . getByTestId ( 'indexes-actions-field' )
386+ . querySelectorAll ( 'button' ) ;
387+ if ( index . name === '_id_' ) {
388+ // you can't delete or hide the _id index
389+ expect ( buttons ) . to . be . empty ;
390+ } else {
391+ expect ( buttons ) . to . not . be . empty ;
392+ }
391393 } ) ;
392394 } ) ;
393395
394396 it ( 'does not render delete and hide/unhide button when a user can not modify indexes (!isWritable)' , function ( ) {
395- renderIndexList ( { isWritable : false , readOnly : false , indexes : indexes } ) ;
396- const indexesList = screen . getByTestId ( 'indexes-list' ) ;
397- expect ( indexesList ) . to . exist ;
398- // TODO
399- /*
400- indexes.forEach((index) => {
401- const indexRow = screen.getByTestId(`indexes-row-${index.name}`);
402- expect(within(indexRow).queryByTestId('indexes-actions-field')).to.not.exist;
403- });
404- */
405- } ) ;
406-
407- it ( 'does not render delete and hide/unhide button when a user can not modify indexes (isWritable, readOnly)' , function ( ) {
408- renderIndexList ( { isWritable : true , readOnly : true , indexes : indexes } ) ;
397+ renderIndexList ( { isWritable : false , indexes : indexes } ) ;
409398 const indexesList = screen . getByTestId ( 'indexes-list' ) ;
410399 expect ( indexesList ) . to . exist ;
411- // TODO
412- /*
413400 indexes . forEach ( ( index ) => {
414401 const indexRow = screen . getByTestId ( `indexes-row-${ index . name } ` ) ;
415- expect(within(indexRow).queryByTestId('indexes-actions-field')).to.not.exist;
402+ expect ( within ( indexRow ) . queryByTestId ( 'indexes-actions-field' ) ) . to . not
403+ . exist ;
416404 } ) ;
417- */
418405 } ) ;
419406
420407 describe ( 'sorting' , function ( ) {
0 commit comments