Skip to content

Commit 626814a

Browse files
Fix nesting in auth config tests (#2228)
1 parent f182c36 commit 626814a

File tree

1 file changed

+50
-48
lines changed

1 file changed

+50
-48
lines changed

test/unit/auth/auth-config.spec.ts

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,60 +1239,62 @@ describe('OIDCConfig', () => {
12391239
});
12401240
});
12411241
});
1242-
describe('PasswordPolicyAuthConfig',() => {
1243-
describe('constructor',() => {
1244-
const validConfig = new PasswordPolicyAuthConfig({
1245-
passwordPolicyEnforcementState: 'ENFORCE',
1242+
});
1243+
1244+
describe('PasswordPolicyAuthConfig',() => {
1245+
describe('constructor',() => {
1246+
const validConfig = new PasswordPolicyAuthConfig({
1247+
passwordPolicyEnforcementState: 'ENFORCE',
1248+
passwordPolicyVersions: [
1249+
{
1250+
customStrengthOptions: {
1251+
containsNumericCharacter: true,
1252+
containsLowercaseCharacter: true,
1253+
containsNonAlphanumericCharacter: true,
1254+
containsUppercaseCharacter: true,
1255+
minPasswordLength: 8,
1256+
maxPasswordLength: 30,
1257+
},
1258+
},
1259+
],
1260+
forceUpgradeOnSignin: true,
1261+
});
1262+
1263+
it('should throw an error on missing state',() => {
1264+
expect(() => new PasswordPolicyAuthConfig({
12461265
passwordPolicyVersions: [
12471266
{
1248-
customStrengthOptions: {
1249-
containsNumericCharacter: true,
1250-
containsLowercaseCharacter: true,
1251-
containsNonAlphanumericCharacter: true,
1252-
containsUppercaseCharacter: true,
1253-
minPasswordLength: 8,
1254-
maxPasswordLength: 30,
1255-
},
1256-
},
1267+
customStrengthOptions: {},
1268+
}
12571269
],
1258-
forceUpgradeOnSignin: true,
1259-
});
1260-
1261-
it('should throw an error on missing state',() => {
1262-
expect(() => new PasswordPolicyAuthConfig({
1263-
passwordPolicyVersions: [
1264-
{
1265-
customStrengthOptions: {},
1266-
}
1267-
],
1268-
} as any)).to.throw('INTERNAL ASSERT FAILED: Invalid password policy configuration response');
1269-
});
1270+
} as any)).to.throw('INTERNAL ASSERT FAILED: Invalid password policy configuration response');
1271+
});
12701272

1271-
it('should set readonly property "enforcementState" to ENFORCE on state enforced',() => {
1272-
expect(validConfig.enforcementState).to.equal('ENFORCE');
1273-
});
1273+
it('should set readonly property "enforcementState" to ENFORCE on state enforced',() => {
1274+
expect(validConfig.enforcementState).to.equal('ENFORCE');
1275+
});
12741276

1275-
it('should set readonly property "enforcementState" to OFF on state disabling',() => {
1276-
const offStateConfig=new PasswordPolicyAuthConfig({
1277-
passwordPolicyEnforcementState: 'OFF',
1278-
});
1279-
expect(offStateConfig.enforcementState).to.equal('OFF');
1277+
it('should set readonly property "enforcementState" to OFF on state disabling',() => {
1278+
const offStateConfig=new PasswordPolicyAuthConfig({
1279+
passwordPolicyEnforcementState: 'OFF',
12801280
});
1281+
expect(offStateConfig.enforcementState).to.equal('OFF');
1282+
});
12811283

1282-
it('should set readonly property "constraints"',() => {
1283-
const expectedConstraints: CustomStrengthOptionsConfig = {
1284-
requireUppercase: true,
1285-
requireLowercase: true,
1286-
requireNonAlphanumeric: true,
1287-
requireNumeric: true,
1288-
minLength: 8,
1289-
maxLength: 30,
1290-
}
1291-
expect(validConfig.constraints).to.deep.equal(expectedConstraints);
1292-
});
1284+
it('should set readonly property "constraints"',() => {
1285+
const expectedConstraints: CustomStrengthOptionsConfig = {
1286+
requireUppercase: true,
1287+
requireLowercase: true,
1288+
requireNonAlphanumeric: true,
1289+
requireNumeric: true,
1290+
minLength: 8,
1291+
maxLength: 30,
1292+
}
1293+
expect(validConfig.constraints).to.deep.equal(expectedConstraints);
1294+
});
12931295

1294-
it('should set readonly property "forceUpgradeOnSignin"',() => {
1295-
expect(validConfig.forceUpgradeOnSignin).to.deep.equal(true);
1296-
});
1296+
it('should set readonly property "forceUpgradeOnSignin"',() => {
1297+
expect(validConfig.forceUpgradeOnSignin).to.deep.equal(true);
12971298
});
1298-
});});
1299+
});
1300+
});

0 commit comments

Comments
 (0)