@@ -53,6 +53,14 @@ const sidebarConnections: SidebarConnection[] = [
5353 pipeline : [ ] ,
5454 isNonExistent : false ,
5555 } ,
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+ } ,
5664 ] ,
5765 collectionsLength : 1 ,
5866 collectionsStatus : 'ready' ,
@@ -70,6 +78,14 @@ const sidebarConnections: SidebarConnection[] = [
7078 pipeline : [ ] ,
7179 isNonExistent : false ,
7280 } ,
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+ } ,
7389 ] ,
7490 collectionsLength : 1 ,
7591 collectionsStatus : 'ready' ,
@@ -626,6 +642,27 @@ describe('useFilteredConnections', function () {
626642 } ) ;
627643 } ) ;
628644
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+
629666 it ( 'as expanded, it should return an object containing an expanded object for the matching items' , async function ( ) {
630667 const { result } = renderHookWithContext ( useFilteredConnections , {
631668 initialProps : {
0 commit comments