@@ -742,6 +742,36 @@ describe('#connections enabled clients functionality', () => {
742
742
]
743
743
) ;
744
744
} ) ;
745
+
746
+ it ( 'should update enabled clients with more than 50 clients' , async ( ) => {
747
+ const connectionId = 'con_123' ;
748
+ const enabledClientIds = Array . from ( { length : 60 } , ( _ , i ) => `client_${ i + 1 } ` ) ;
749
+ const typeName = 'connection' ;
750
+
751
+ mockAuth0Client . connections . updateEnabledClients . resolves ( ) ;
752
+
753
+ const result = await updateConnectionEnabledClients (
754
+ mockAuth0Client ,
755
+ typeName ,
756
+ connectionId ,
757
+ enabledClientIds
758
+ ) ;
759
+
760
+ expect ( result ) . to . equal ( true ) ;
761
+ sinon . assert . calledTwice ( mockAuth0Client . connections . updateEnabledClients ) ;
762
+
763
+ const firstCall = mockAuth0Client . connections . updateEnabledClients . getCall ( 0 ) ;
764
+ expect ( firstCall . args [ 0 ] ) . to . deep . equal ( { id : connectionId } ) ;
765
+ expect ( firstCall . args [ 1 ] ) . to . have . length ( 50 ) ;
766
+ expect ( firstCall . args [ 1 ] [ 0 ] ) . to . deep . equal ( { client_id : 'client_1' , status : true } ) ;
767
+ expect ( firstCall . args [ 1 ] [ 49 ] ) . to . deep . equal ( { client_id : 'client_50' , status : true } ) ;
768
+
769
+ const secondCall = mockAuth0Client . connections . updateEnabledClients . getCall ( 1 ) ;
770
+ expect ( secondCall . args [ 0 ] ) . to . deep . equal ( { id : connectionId } ) ;
771
+ expect ( secondCall . args [ 1 ] ) . to . have . length ( 10 ) ;
772
+ expect ( secondCall . args [ 1 ] [ 0 ] ) . to . deep . equal ( { client_id : 'client_51' , status : true } ) ;
773
+ expect ( secondCall . args [ 1 ] [ 9 ] ) . to . deep . equal ( { client_id : 'client_60' , status : true } ) ;
774
+ } ) ;
745
775
} ) ;
746
776
747
777
describe ( '#processConnectionEnabledClients' , ( ) => {
0 commit comments