@@ -160,7 +160,7 @@ const data = [
160
160
role : 'manager' ,
161
161
firstName : 'first' ,
162
162
lastName : 'last' ,
163
- handle : 'manager_handle ' ,
163
+ handle : 'MANAGER_HANDLE ' ,
164
164
isPrimary : true ,
165
165
createdBy : 1 ,
166
166
updatedBy : 1 ,
@@ -723,7 +723,7 @@ describe('LIST Project', () => {
723
723
} ) ;
724
724
} ) ;
725
725
726
- it ( 'should return all projects that match when filtering by customer handle' , ( done ) => {
726
+ it ( 'should return all projects that match when filtering by customer handle (lowercase) ' , ( done ) => {
727
727
request ( server )
728
728
. get ( '/v5/projects/?customer=*tourist*' )
729
729
. set ( {
@@ -746,7 +746,53 @@ describe('LIST Project', () => {
746
746
} ) ;
747
747
} ) ;
748
748
749
- it ( 'should return all projects that match when filtering by manager handle' , ( done ) => {
749
+ it ( 'should return all projects that match when filtering by customer handle (uppercase)' , ( done ) => {
750
+ request ( server )
751
+ . get ( '/v5/projects/?customer=*TOUR*' )
752
+ . set ( {
753
+ Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
754
+ } )
755
+ . expect ( 'Content-Type' , / j s o n / )
756
+ . expect ( 200 )
757
+ . end ( ( err , res ) => {
758
+ if ( err ) {
759
+ done ( err ) ;
760
+ } else {
761
+ const resJson = res . body ;
762
+ should . exist ( resJson ) ;
763
+ resJson . should . have . lengthOf ( 1 ) ;
764
+ resJson [ 0 ] . name . should . equal ( 'test1' ) ;
765
+ resJson [ 0 ] . members . should . have . deep . property ( '[0].role' , 'customer' ) ;
766
+ resJson [ 0 ] . members [ 0 ] . userId . should . equal ( 40051331 ) ;
767
+ done ( ) ;
768
+ }
769
+ } ) ;
770
+ } ) ;
771
+
772
+ it ( 'should return all projects that match when filtering by customer handle (mixed case)' , ( done ) => {
773
+ request ( server )
774
+ . get ( '/v5/projects/?customer=*tOURiS*' )
775
+ . set ( {
776
+ Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
777
+ } )
778
+ . expect ( 'Content-Type' , / j s o n / )
779
+ . expect ( 200 )
780
+ . end ( ( err , res ) => {
781
+ if ( err ) {
782
+ done ( err ) ;
783
+ } else {
784
+ const resJson = res . body ;
785
+ should . exist ( resJson ) ;
786
+ resJson . should . have . lengthOf ( 1 ) ;
787
+ resJson [ 0 ] . name . should . equal ( 'test1' ) ;
788
+ resJson [ 0 ] . members . should . have . deep . property ( '[0].role' , 'customer' ) ;
789
+ resJson [ 0 ] . members [ 0 ] . userId . should . equal ( 40051331 ) ;
790
+ done ( ) ;
791
+ }
792
+ } ) ;
793
+ } ) ;
794
+
795
+ it ( 'should return all projects that match when filtering by manager handle (lowercase)' , ( done ) => {
750
796
request ( server )
751
797
. get ( '/v5/projects/?manager=*_handle' )
752
798
. set ( {
@@ -769,6 +815,52 @@ describe('LIST Project', () => {
769
815
} ) ;
770
816
} ) ;
771
817
818
+ it ( 'should return all projects that match when filtering by manager handle (uppercase)' , ( done ) => {
819
+ request ( server )
820
+ . get ( '/v5/projects/?manager=MANAG*' )
821
+ . set ( {
822
+ Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
823
+ } )
824
+ . expect ( 'Content-Type' , / j s o n / )
825
+ . expect ( 200 )
826
+ . end ( ( err , res ) => {
827
+ if ( err ) {
828
+ done ( err ) ;
829
+ } else {
830
+ const resJson = res . body ;
831
+ should . exist ( resJson ) ;
832
+ resJson . should . have . lengthOf ( 1 ) ;
833
+ resJson [ 0 ] . name . should . equal ( 'test3' ) ;
834
+ resJson [ 0 ] . members . should . have . deep . property ( '[0].role' , 'manager' ) ;
835
+ resJson [ 0 ] . members [ 0 ] . userId . should . equal ( 40051334 ) ;
836
+ done ( ) ;
837
+ }
838
+ } ) ;
839
+ } ) ;
840
+
841
+ it ( 'should return all projects that match when filtering by manager handle (mixed case)' , ( done ) => {
842
+ request ( server )
843
+ . get ( '/v5/projects/?manager=*_HAndLe' )
844
+ . set ( {
845
+ Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
846
+ } )
847
+ . expect ( 'Content-Type' , / j s o n / )
848
+ . expect ( 200 )
849
+ . end ( ( err , res ) => {
850
+ if ( err ) {
851
+ done ( err ) ;
852
+ } else {
853
+ const resJson = res . body ;
854
+ should . exist ( resJson ) ;
855
+ resJson . should . have . lengthOf ( 1 ) ;
856
+ resJson [ 0 ] . name . should . equal ( 'test3' ) ;
857
+ resJson [ 0 ] . members . should . have . deep . property ( '[0].role' , 'manager' ) ;
858
+ resJson [ 0 ] . members [ 0 ] . userId . should . equal ( 40051334 ) ;
859
+ done ( ) ;
860
+ }
861
+ } ) ;
862
+ } ) ;
863
+
772
864
it ( 'should return all projects that match when filtering by manager, searching on any non-customer role' , ( done ) => {
773
865
request ( server )
774
866
. get ( '/v5/projects/?manager=copi*' )
0 commit comments