diff --git a/test/unit/auth/auth-config.spec.ts b/test/unit/auth/auth-config.spec.ts index b94db6d38c..69ad0c4c59 100644 --- a/test/unit/auth/auth-config.spec.ts +++ b/test/unit/auth/auth-config.spec.ts @@ -1239,60 +1239,62 @@ describe('OIDCConfig', () => { }); }); }); - describe('PasswordPolicyAuthConfig',() => { - describe('constructor',() => { - const validConfig = new PasswordPolicyAuthConfig({ - passwordPolicyEnforcementState: 'ENFORCE', +}); + +describe('PasswordPolicyAuthConfig',() => { + describe('constructor',() => { + const validConfig = new PasswordPolicyAuthConfig({ + passwordPolicyEnforcementState: 'ENFORCE', + passwordPolicyVersions: [ + { + customStrengthOptions: { + containsNumericCharacter: true, + containsLowercaseCharacter: true, + containsNonAlphanumericCharacter: true, + containsUppercaseCharacter: true, + minPasswordLength: 8, + maxPasswordLength: 30, + }, + }, + ], + forceUpgradeOnSignin: true, + }); + + it('should throw an error on missing state',() => { + expect(() => new PasswordPolicyAuthConfig({ passwordPolicyVersions: [ { - customStrengthOptions: { - containsNumericCharacter: true, - containsLowercaseCharacter: true, - containsNonAlphanumericCharacter: true, - containsUppercaseCharacter: true, - minPasswordLength: 8, - maxPasswordLength: 30, - }, - }, + customStrengthOptions: {}, + } ], - forceUpgradeOnSignin: true, - }); - - it('should throw an error on missing state',() => { - expect(() => new PasswordPolicyAuthConfig({ - passwordPolicyVersions: [ - { - customStrengthOptions: {}, - } - ], - } as any)).to.throw('INTERNAL ASSERT FAILED: Invalid password policy configuration response'); - }); + } as any)).to.throw('INTERNAL ASSERT FAILED: Invalid password policy configuration response'); + }); - it('should set readonly property "enforcementState" to ENFORCE on state enforced',() => { - expect(validConfig.enforcementState).to.equal('ENFORCE'); - }); + it('should set readonly property "enforcementState" to ENFORCE on state enforced',() => { + expect(validConfig.enforcementState).to.equal('ENFORCE'); + }); - it('should set readonly property "enforcementState" to OFF on state disabling',() => { - const offStateConfig=new PasswordPolicyAuthConfig({ - passwordPolicyEnforcementState: 'OFF', - }); - expect(offStateConfig.enforcementState).to.equal('OFF'); + it('should set readonly property "enforcementState" to OFF on state disabling',() => { + const offStateConfig=new PasswordPolicyAuthConfig({ + passwordPolicyEnforcementState: 'OFF', }); + expect(offStateConfig.enforcementState).to.equal('OFF'); + }); - it('should set readonly property "constraints"',() => { - const expectedConstraints: CustomStrengthOptionsConfig = { - requireUppercase: true, - requireLowercase: true, - requireNonAlphanumeric: true, - requireNumeric: true, - minLength: 8, - maxLength: 30, - } - expect(validConfig.constraints).to.deep.equal(expectedConstraints); - }); + it('should set readonly property "constraints"',() => { + const expectedConstraints: CustomStrengthOptionsConfig = { + requireUppercase: true, + requireLowercase: true, + requireNonAlphanumeric: true, + requireNumeric: true, + minLength: 8, + maxLength: 30, + } + expect(validConfig.constraints).to.deep.equal(expectedConstraints); + }); - it('should set readonly property "forceUpgradeOnSignin"',() => { - expect(validConfig.forceUpgradeOnSignin).to.deep.equal(true); - }); + it('should set readonly property "forceUpgradeOnSignin"',() => { + expect(validConfig.forceUpgradeOnSignin).to.deep.equal(true); }); - });}); + }); +});