@@ -57,6 +57,7 @@ const STANDARD_INBOUND_ADAPTER = "9KWCqlIyy7"
5757const STANDARD_ROUTER = "LoiC2CFbLP"
5858const STANDARD_POLLER_CHILD = "mcyTryMPewJ"
5959const STANDARD_TRANSACTIONAL_CHILD = "V1ls9ri4szs"
60+ const NESTED_CHILD_PARENT_ID = "FL5Tssm8tV"
6061
6162beforeEach ( ( ) => {
6263 act ( ( ) => {
@@ -423,6 +424,28 @@ describe("disable child", () => {
423424 )
424425
425426 expect ( children ) . toHaveLength ( 0 )
427+ expect ( getEipId ( STANDARD_POLLER_CHILD ) ) . toBeUndefined ( )
428+ } )
429+
430+ test ( "disable child deletes all nested children" , ( ) => {
431+ act ( ( ) => resetMockStore ( nestedChildFlow ) )
432+
433+ const initChildren = renderAndUnwrapHook ( ( ) =>
434+ useGetEnabledChildren ( NESTED_CHILD_PARENT_ID )
435+ )
436+ expect ( initChildren ) . toHaveLength ( 3 )
437+
438+ const topChildId = "43FAdk5SdBR"
439+ act ( ( ) => disableChild ( NESTED_CHILD_PARENT_ID , topChildId ) )
440+
441+ const updatedChildren = renderAndUnwrapHook ( ( ) =>
442+ useGetEnabledChildren ( NESTED_CHILD_PARENT_ID )
443+ )
444+ expect ( updatedChildren ) . toHaveLength ( initChildren . length - 1 )
445+
446+ expect ( getEipId ( topChildId ) ) . toBeUndefined ( )
447+ expect ( getEipId ( "9OymVfY4n4p" ) ) . toBeUndefined ( )
448+ expect ( getEipId ( "gCL0YkrFGgW" ) ) . toBeUndefined ( )
426449 } )
427450
428451 test ( "disable child unknown child id -> error" , ( ) => {
@@ -455,10 +478,10 @@ describe("reorder enabled child list", () => {
455478 } )
456479 } )
457480
458- const PARENT_ID = "FL5Tssm8tV"
459-
460481 test ( "reorder enabled children success" , ( ) => {
461- const initial = renderAndUnwrapHook ( ( ) => useGetEnabledChildren ( PARENT_ID ) )
482+ const initial = renderAndUnwrapHook ( ( ) =>
483+ useGetEnabledChildren ( NESTED_CHILD_PARENT_ID )
484+ )
462485
463486 const updated = [ ...initial ]
464487
@@ -467,26 +490,38 @@ describe("reorder enabled child list", () => {
467490 updated [ 2 ] = updated [ 0 ]
468491 updated [ 0 ] = temp
469492
470- act ( ( ) => reorderEnabledChildren ( PARENT_ID , updated ) )
493+ act ( ( ) => reorderEnabledChildren ( NESTED_CHILD_PARENT_ID , updated ) )
471494
472- const children = renderAndUnwrapHook ( ( ) => useGetEnabledChildren ( PARENT_ID ) )
495+ const children = renderAndUnwrapHook ( ( ) =>
496+ useGetEnabledChildren ( NESTED_CHILD_PARENT_ID )
497+ )
473498 expect ( children ) . toEqual ( updated )
474499 } )
475500
476501 test ( "adding child -> error " , ( ) => {
477- const initial = renderAndUnwrapHook ( ( ) => useGetEnabledChildren ( PARENT_ID ) )
502+ const initial = renderAndUnwrapHook ( ( ) =>
503+ useGetEnabledChildren ( NESTED_CHILD_PARENT_ID )
504+ )
478505 const updated = [ ...initial , "extra" ]
479- expect ( ( ) => reorderEnabledChildren ( PARENT_ID , updated ) ) . toThrowError ( )
506+ expect ( ( ) =>
507+ reorderEnabledChildren ( NESTED_CHILD_PARENT_ID , updated )
508+ ) . toThrowError ( )
480509 } )
481510
482511 test ( "removing child -> error " , ( ) => {
483- const initial = renderAndUnwrapHook ( ( ) => useGetEnabledChildren ( PARENT_ID ) )
512+ const initial = renderAndUnwrapHook ( ( ) =>
513+ useGetEnabledChildren ( NESTED_CHILD_PARENT_ID )
514+ )
484515 const updated = initial . slice ( 1 )
485- expect ( ( ) => reorderEnabledChildren ( PARENT_ID , updated ) ) . toThrowError ( )
516+ expect ( ( ) =>
517+ reorderEnabledChildren ( NESTED_CHILD_PARENT_ID , updated )
518+ ) . toThrowError ( )
486519 } )
487520
488521 test ( "changing child list -> error " , ( ) => {
489- expect ( ( ) => reorderEnabledChildren ( PARENT_ID , [ "c1" , "c2" ] ) ) . toThrowError ( )
522+ expect ( ( ) =>
523+ reorderEnabledChildren ( NESTED_CHILD_PARENT_ID , [ "c1" , "c2" ] )
524+ ) . toThrowError ( )
490525 } )
491526} )
492527
0 commit comments