@@ -12,33 +12,36 @@ describe('SamlConnectionAPI', () => {
1212
1313 describe ( 'getSamlConnectionList' , ( ) => {
1414 it ( 'successfully fetches SAML connections with all parameters' , async ( ) => {
15- const mockSamlConnectionsResponse = [
16- {
17- object : 'saml_connection' ,
18- id : 'samlc_123' ,
19- name : 'Test Connection' ,
20- provider : 'saml_custom' ,
21- domain : 'test.example.com' ,
22- organization_id : 'org_123' ,
23- created_at : 1672531200000 ,
24- updated_at : 1672531200000 ,
25- active : true ,
26- sync_user_attributes : false ,
27- allow_subdomains : false ,
28- allow_idp_initiated : false ,
29- idp_entity_id : 'entity_123' ,
30- idp_sso_url : 'https://idp.example.com/sso' ,
31- idp_certificate : 'cert_data' ,
32- idp_metadata_url : null ,
33- idp_metadata : null ,
34- attribute_mapping : {
35- user_id : 'userId' ,
36- email_address : 'email' ,
37- first_name : 'firstName' ,
38- last_name : 'lastName' ,
15+ const mockSamlConnectionsResponse = {
16+ data : [
17+ {
18+ object : 'saml_connection' ,
19+ id : 'samlc_123' ,
20+ name : 'Test Connection' ,
21+ provider : 'saml_custom' ,
22+ domain : 'test.example.com' ,
23+ organization_id : 'org_123' ,
24+ created_at : 1672531200000 ,
25+ updated_at : 1672531200000 ,
26+ active : true ,
27+ sync_user_attributes : false ,
28+ allow_subdomains : false ,
29+ allow_idp_initiated : false ,
30+ idp_entity_id : 'entity_123' ,
31+ idp_sso_url : 'https://idp.example.com/sso' ,
32+ idp_certificate : 'cert_data' ,
33+ idp_metadata_url : null ,
34+ idp_metadata : null ,
35+ attribute_mapping : {
36+ user_id : 'userId' ,
37+ email_address : 'email' ,
38+ first_name : 'firstName' ,
39+ last_name : 'lastName' ,
40+ } ,
3941 } ,
40- } ,
41- ] ;
42+ ] ,
43+ total_count : 1 ,
44+ } ;
4245
4346 server . use (
4447 http . get (
@@ -50,7 +53,7 @@ describe('SamlConnectionAPI', () => {
5053 expect ( url . searchParams . get ( 'limit' ) ) . toBe ( '5' ) ;
5154 expect ( url . searchParams . get ( 'offset' ) ) . toBe ( '10' ) ;
5255 expect ( url . searchParams . getAll ( 'organization_id' ) ) . toEqual ( [ '+org_123' , '-org_456' ] ) ;
53- return HttpResponse . json ( { data : mockSamlConnectionsResponse } ) ;
56+ return HttpResponse . json ( mockSamlConnectionsResponse ) ;
5457 } ) ,
5558 ) ,
5659 ) ;
@@ -63,10 +66,11 @@ describe('SamlConnectionAPI', () => {
6366 offset : 10 ,
6467 } ) ;
6568
66- expect ( response ) . toHaveLength ( 1 ) ;
67- expect ( response [ 0 ] . id ) . toBe ( 'samlc_123' ) ;
68- expect ( response [ 0 ] . name ) . toBe ( 'Test Connection' ) ;
69- expect ( response [ 0 ] . organizationId ) . toBe ( 'org_123' ) ;
69+ expect ( response . data ) . toHaveLength ( 1 ) ;
70+ expect ( response . data [ 0 ] . id ) . toBe ( 'samlc_123' ) ;
71+ expect ( response . data [ 0 ] . name ) . toBe ( 'Test Connection' ) ;
72+ expect ( response . data [ 0 ] . organizationId ) . toBe ( 'org_123' ) ;
73+ expect ( response . totalCount ) . toBe ( 1 ) ;
7074 } ) ;
7175 } ) ;
7276} ) ;
0 commit comments