@@ -550,6 +550,60 @@ describe(`Tests ${example.url}`, () => {
550550 }
551551 } ) ;
552552
553+ it ( 'should successfully return records filtered by name search (q) and domainId combined' , async ( ) => {
554+ const teardownFns : ( ( ) => Promise < void > ) [ ] = [ ] ;
555+
556+ try {
557+ for ( const app of example . appsList ) {
558+ await req . post ( example . url ) . send ( app ) . expect ( 200 ) ;
559+ }
560+ teardownFns . unshift ( async ( ) => {
561+ for ( const app of example . appsList ) {
562+ await req . delete ( example . url + app . name ) . expect ( 204 ) ;
563+ }
564+ } ) ;
565+
566+ const template = {
567+ name : 'hello500' ,
568+ content : '<html><head></head><body class="custom">hello500</body></html>' ,
569+ } ;
570+ await req . post ( '/api/v1/template' ) . send ( template ) . expect ( 200 ) ;
571+ teardownFns . unshift ( async ( ) => {
572+ await req . delete ( '/api/v1/template/' + template . name ) . expect ( 204 ) ;
573+ } ) ;
574+
575+ const domain = { domainName : 'example.com' , template500 : template . name } ;
576+ const {
577+ body : { id : routerDomainId } ,
578+ } = await req . post ( '/api/v1/router_domains' ) . send ( domain ) . expect ( 200 ) ;
579+ teardownFns . unshift ( async ( ) => {
580+ await req . delete ( '/api/v1/router_domains/' + routerDomainId ) . expect ( 204 ) ;
581+ } ) ;
582+
583+ const route = {
584+ next : false ,
585+ slots : { myslot : { appName : example . appsList [ 1 ] . name , kind : 'primary' } } ,
586+ route : 'myroute' ,
587+ domainId : routerDomainId ,
588+ } ;
589+ const {
590+ body : { id : routeId } ,
591+ } = await req . post ( '/api/v1/route' ) . send ( route ) . expect ( 200 ) ;
592+ teardownFns . unshift ( async ( ) => {
593+ await req . delete ( '/api/v1/route/' + routeId ) . expect ( 204 ) ;
594+ } ) ;
595+
596+ const query = makeFilterQuery ( { q : 'app1' , domainId : routerDomainId } ) ;
597+ const response = await req . get ( `${ example . url } ?${ query } ` ) . expect ( 200 ) ;
598+
599+ expectAppsListEqual ( response . body , [ example . appsList [ 1 ] ] ) ;
600+ } finally {
601+ for ( const fn of teardownFns ) {
602+ await fn ( ) ;
603+ }
604+ }
605+ } ) ;
606+
553607 it ( 'should successfully filter by name array (single name)' , async ( ) => {
554608 try {
555609 for ( const app of example . appsList ) {
0 commit comments