@@ -387,5 +387,109 @@ describe('LIST Project', () => {
387387 }
388388 } ) ;
389389 } ) ;
390+
391+ describe ( 'GET All /projects/ for Connect Admin, ' , ( ) => {
392+ it ( 'should return the project ' , ( done ) => {
393+ request ( server )
394+ . get ( '/v4/projects/?fields=id%2Cmembers.id' )
395+ . set ( {
396+ Authorization : `Bearer ${ testUtil . jwts . connectAdmin } ` ,
397+ } )
398+ . expect ( 'Content-Type' , / j s o n / )
399+ . expect ( 200 )
400+ . end ( ( err , res ) => {
401+ if ( err ) {
402+ done ( err ) ;
403+ } else {
404+ const resJson = res . body . result . content ;
405+ should . exist ( resJson ) ;
406+ resJson . should . have . lengthOf ( 3 ) ;
407+ done ( ) ;
408+ }
409+ } ) ;
410+ } ) ;
411+
412+ it ( 'should return all projects, that match when filtering by name' , ( done ) => {
413+ request ( server )
414+ . get ( '/v4/projects/?filter=keyword%3Dtest' )
415+ . set ( {
416+ Authorization : `Bearer ${ testUtil . jwts . connectAdmin } ` ,
417+ } )
418+ . expect ( 'Content-Type' , / j s o n / )
419+ . expect ( 200 )
420+ . end ( ( err , res ) => {
421+ if ( err ) {
422+ done ( err ) ;
423+ } else {
424+ const resJson = res . body . result . content ;
425+ should . exist ( resJson ) ;
426+ resJson . should . have . lengthOf ( 3 ) ;
427+ done ( ) ;
428+ }
429+ } ) ;
430+ } ) ;
431+
432+ it ( 'should return the project, when filtering by keyword, which matches the name' , ( done ) => {
433+ request ( server )
434+ . get ( '/v4/projects/?filter=keyword%3D1' )
435+ . set ( {
436+ Authorization : `Bearer ${ testUtil . jwts . connectAdmin } ` ,
437+ } )
438+ . expect ( 'Content-Type' , / j s o n / )
439+ . expect ( 200 )
440+ . end ( ( err , res ) => {
441+ if ( err ) {
442+ done ( err ) ;
443+ } else {
444+ const resJson = res . body . result . content ;
445+ should . exist ( resJson ) ;
446+ resJson . should . have . lengthOf ( 1 ) ;
447+ resJson [ 0 ] . name . should . equal ( 'test1' ) ;
448+ done ( ) ;
449+ }
450+ } ) ;
451+ } ) ;
452+
453+ it ( 'should return the project, when filtering by keyword, which matches the description' , ( done ) => {
454+ request ( server )
455+ . get ( '/v4/projects/?filter=keyword%3Dproject' )
456+ . set ( {
457+ Authorization : `Bearer ${ testUtil . jwts . connectAdmin } ` ,
458+ } )
459+ . expect ( 'Content-Type' , / j s o n / )
460+ . expect ( 200 )
461+ . end ( ( err , res ) => {
462+ if ( err ) {
463+ done ( err ) ;
464+ } else {
465+ const resJson = res . body . result . content ;
466+ should . exist ( resJson ) ;
467+ resJson . should . have . lengthOf ( 3 ) ;
468+ done ( ) ;
469+ }
470+ } ) ;
471+ } ) ;
472+
473+ it ( 'should return the project, when filtering by keyword, which matches the member handle' , ( done ) => {
474+ request ( server )
475+ . get ( '/v4/projects/?filter=keyword%3Dtourist' )
476+ . set ( {
477+ Authorization : `Bearer ${ testUtil . jwts . connectAdmin } ` ,
478+ } )
479+ . expect ( 'Content-Type' , / j s o n / )
480+ . expect ( 200 )
481+ . end ( ( err , res ) => {
482+ if ( err ) {
483+ done ( err ) ;
484+ } else {
485+ const resJson = res . body . result . content ;
486+ should . exist ( resJson ) ;
487+ resJson . should . have . lengthOf ( 1 ) ;
488+ resJson [ 0 ] . name . should . equal ( 'test1' ) ;
489+ done ( ) ;
490+ }
491+ } ) ;
492+ } ) ;
493+ } ) ;
390494 } ) ;
391495} ) ;
0 commit comments