File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -646,6 +646,23 @@ describe('assertRequirementsNotTooComplex', () => {
646646 mockContext
647647 )
648648 ) . toThrow ( 'Compliance Requirement complexity limit exceeded' ) ;
649+
650+ expect ( ( ) =>
651+ assertRequirementsNotTooComplex (
652+ [
653+ {
654+ type : ConditionType . IsPresent ,
655+ target : ConditionTarget . Both ,
656+ } ,
657+ {
658+ type : ConditionType . IsAbsent ,
659+ target : ConditionTarget . Receiver ,
660+ } ,
661+ ] as Condition [ ] ,
662+ new BigNumber ( 0 ) ,
663+ mockContext
664+ )
665+ ) . toThrow ( 'Compliance Requirement complexity limit exceeded' ) ;
649666 } ) ;
650667
651668 it ( 'should not throw an error if the complexity is less than the max condition complexity' , async ( ) => {
Original file line number Diff line number Diff line change @@ -335,7 +335,9 @@ export function assertRequirementsNotTooComplex(
335335 conditionComplexitySum = conditionComplexitySum . multipliedBy ( 2 ) ;
336336 }
337337
338- const claimIssuerLength = trustedClaimIssuers . length || defaultClaimIssuerLength ;
338+ // if there are no specific trusted claim issuers or default, 1 must be used for calculation
339+ const claimIssuerLength =
340+ trustedClaimIssuers . length || defaultClaimIssuerLength . toNumber ( ) || 1 ;
339341 conditionComplexitySum = conditionComplexitySum . multipliedBy ( claimIssuerLength ) ;
340342
341343 complexitySum = complexitySum . plus ( conditionComplexitySum ) ;
You can’t perform that action at this time.
0 commit comments