@@ -683,6 +683,52 @@ describe('LIST Project', () => {
683683 } ) ;
684684 } ) ;
685685
686+ it ( 'should return all projects that match when filtering by customer handle' , ( done ) => {
687+ request ( server )
688+ . get ( '/v5/projects/?customer=*tourist*' )
689+ . set ( {
690+ Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
691+ } )
692+ . expect ( 'Content-Type' , / j s o n / )
693+ . expect ( 200 )
694+ . end ( ( err , res ) => {
695+ if ( err ) {
696+ done ( err ) ;
697+ } else {
698+ const resJson = res . body ;
699+ should . exist ( resJson ) ;
700+ resJson . should . have . lengthOf ( 1 ) ;
701+ resJson [ 0 ] . name . should . equal ( 'test1' ) ;
702+ resJson [ 0 ] . members . should . have . deep . property ( '[0].role' , 'customer' ) ;
703+ resJson [ 0 ] . members [ 0 ] . userId . should . equal ( 40051331 ) ;
704+ done ( ) ;
705+ }
706+ } ) ;
707+ } ) ;
708+
709+ it ( 'should return all projects that match when filtering by manager handle' , ( done ) => {
710+ request ( server )
711+ . get ( '/v5/projects/?manager=*_handle' )
712+ . set ( {
713+ Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
714+ } )
715+ . expect ( 'Content-Type' , / j s o n / )
716+ . expect ( 200 )
717+ . end ( ( err , res ) => {
718+ if ( err ) {
719+ done ( err ) ;
720+ } else {
721+ const resJson = res . body ;
722+ should . exist ( resJson ) ;
723+ resJson . should . have . lengthOf ( 1 ) ;
724+ resJson [ 0 ] . name . should . equal ( 'test3' ) ;
725+ resJson [ 0 ] . members . should . have . deep . property ( '[0].role' , 'manager' ) ;
726+ resJson [ 0 ] . members [ 0 ] . userId . should . equal ( 40051334 ) ;
727+ done ( ) ;
728+ }
729+ } ) ;
730+ } ) ;
731+
686732 it ( 'should return list of projects ordered ascending by lastActivityAt when sort column is "lastActivityAt"' , ( done ) => {
687733 request ( server )
688734 . get ( '/v5/projects/?sort=lastActivityAt' )
0 commit comments