@@ -53,6 +53,14 @@ const sidebarConnections: SidebarConnection[] = [
53
53
pipeline : [ ] ,
54
54
isNonExistent : false ,
55
55
} ,
56
+ {
57
+ _id : 'coll_ready_1_1_2' ,
58
+ name : 'coll_ready_shared_name' ,
59
+ type : 'collection' ,
60
+ sourceName : '' ,
61
+ pipeline : [ ] ,
62
+ isNonExistent : false ,
63
+ } ,
56
64
] ,
57
65
collectionsLength : 1 ,
58
66
collectionsStatus : 'ready' ,
@@ -70,6 +78,14 @@ const sidebarConnections: SidebarConnection[] = [
70
78
pipeline : [ ] ,
71
79
isNonExistent : false ,
72
80
} ,
81
+ {
82
+ _id : 'coll_ready_1_2_2' ,
83
+ name : 'coll_ready_shared_name' ,
84
+ type : 'collection' ,
85
+ sourceName : '' ,
86
+ pipeline : [ ] ,
87
+ isNonExistent : false ,
88
+ } ,
73
89
] ,
74
90
collectionsLength : 1 ,
75
91
collectionsStatus : 'ready' ,
@@ -626,6 +642,27 @@ describe('useFilteredConnections', function () {
626
642
} ) ;
627
643
} ) ;
628
644
645
+ it ( 'should filter collection items and database items using dot notation' , async function ( ) {
646
+ const { result } = renderHookWithContext ( useFilteredConnections , {
647
+ initialProps : {
648
+ connections : mockSidebarConnections ,
649
+ filter : {
650
+ regex : new RegExp ( 'ready_1_1.coll_ready_shared_name' , 'i' ) , // this matches only coll_ready_shared_name collection in ready_1_1 database
651
+ excludeInactive : false ,
652
+ } ,
653
+ fetchAllCollections : fetchAllCollectionsStub ,
654
+ onDatabaseExpand : onDatabaseExpandStub ,
655
+ } ,
656
+ } ) ;
657
+
658
+ await waitFor ( ( ) => {
659
+ expect (
660
+ ( result . current . filtered ?. [ 0 ] as SidebarConnectedConnection )
661
+ . databases [ 0 ] . collections
662
+ ) . to . have . length ( 1 ) ; // the result has 1 collection
663
+ } ) ;
664
+ } ) ;
665
+
629
666
it ( 'as expanded, it should return an object containing an expanded object for the matching items' , async function ( ) {
630
667
const { result } = renderHookWithContext ( useFilteredConnections , {
631
668
initialProps : {
0 commit comments