@@ -811,7 +811,7 @@ describe('Management User', () => {
811811 } ) ;
812812 } ) ;
813813
814- describe ( 'search ' , ( ) => {
814+ describe ( 'searchTestUsers ' , ( ) => {
815815 it ( 'should send the correct request and receive correct response' , async ( ) => {
816816 const httpResponse = {
817817 ok : true ,
@@ -822,7 +822,64 @@ describe('Management User', () => {
822822 status : 200 ,
823823 } ;
824824 mockHttpClient . post . mockResolvedValue ( httpResponse ) ;
825+ const now = new Date ( ) . getTime ( ) ;
826+ const resp : SdkResponse < UserResponse [ ] > = await management . user . searchTestUsers ( {
827+ tenantIds : [ 't1' ] ,
828+ roles : [ 'r1' ] ,
829+ limit : 100 ,
830+ statuses : [ 'enabled' ] ,
831+ 832+ phones : [ '+11111111' ] ,
833+ text : 'some text' ,
834+ fromCreatedTime : now ,
835+ toCreatedTime : now ,
836+ fromModifiedTime : now ,
837+ toModifiedTime : now ,
838+ sort : [ { field : 'aa' , desc : true } , { field : 'bb' } ] ,
839+ } ) ;
840+
841+ expect ( mockHttpClient . post ) . toHaveBeenCalledWith (
842+ apiPaths . user . searchTestUsers ,
843+ {
844+ tenantIds : [ 't1' ] ,
845+ roleNames : [ 'r1' ] ,
846+ limit : 100 ,
847+ statuses : [ 'enabled' ] ,
848+ 849+ phones : [ '+11111111' ] ,
850+ text : 'some text' ,
851+ fromCreatedTime : now ,
852+ toCreatedTime : now ,
853+ fromModifiedTime : now ,
854+ toModifiedTime : now ,
855+ withTestUser : true ,
856+ testUsersOnly : true ,
857+ sort : [ { field : 'aa' , desc : true } , { field : 'bb' } ] ,
858+ } ,
859+ { token : 'key' } ,
860+ ) ;
861+
862+ expect ( resp ) . toEqual ( {
863+ code : 200 ,
864+ data : [ mockUserResponse ] ,
865+ ok : true ,
866+ response : httpResponse ,
867+ } ) ;
868+ } ) ;
869+ } ) ;
825870
871+ describe ( 'search' , ( ) => {
872+ it ( 'should send the correct request and receive correct response' , async ( ) => {
873+ const httpResponse = {
874+ ok : true ,
875+ json : ( ) => mockMgmtUsersResponse ,
876+ clone : ( ) => ( {
877+ json : ( ) => Promise . resolve ( mockMgmtUsersResponse ) ,
878+ } ) ,
879+ status : 200 ,
880+ } ;
881+ mockHttpClient . post . mockResolvedValue ( httpResponse ) ;
882+ const now = new Date ( ) . getTime ( ) ;
826883 const resp : SdkResponse < UserResponse [ ] > = await management . user . search ( {
827884 tenantIds : [ 't1' ] ,
828885 roles : [ 'r1' ] ,
@@ -831,6 +888,10 @@ describe('Management User', () => {
831888832889 phones : [ '+11111111' ] ,
833890 text : 'some text' ,
891+ fromCreatedTime : now ,
892+ toCreatedTime : now ,
893+ fromModifiedTime : now ,
894+ toModifiedTime : now ,
834895 sort : [ { field : 'aa' , desc : true } , { field : 'bb' } ] ,
835896 } ) ;
836897
@@ -844,6 +905,10 @@ describe('Management User', () => {
844905845906 phones : [ '+11111111' ] ,
846907 text : 'some text' ,
908+ fromCreatedTime : now ,
909+ toCreatedTime : now ,
910+ fromModifiedTime : now ,
911+ toModifiedTime : now ,
847912 sort : [ { field : 'aa' , desc : true } , { field : 'bb' } ] ,
848913 } ,
849914 { token : 'key' } ,
0 commit comments