Release 2.8.0
This commit is contained in:
@@ -8,4 +8,23 @@ test('password strength requires a longer mixed-character password', () => {
|
||||
assert.equal(validatePasswordStrength('1234567890'), 'Password must be at least 10 characters and include 3 of: uppercase, lowercase, number, and symbol.');
|
||||
assert.equal(validatePasswordStrength('Password12'), '');
|
||||
assert.equal(validatePasswordStrength('NewPassword!1'), '');
|
||||
});
|
||||
|
||||
test('password strength supports strong and strict policies', () => {
|
||||
assert.equal(validatePasswordStrength('Password12', { policy: 'strong' }), 'Password must be at least 12 characters and include 3 of: uppercase, lowercase, number, and symbol.');
|
||||
assert.equal(validatePasswordStrength('Password12!!', { policy: 'strong' }), '');
|
||||
assert.equal(validatePasswordStrength('Password12!Abc', { policy: 'strict' }), '');
|
||||
assert.equal(validatePasswordStrength('Password12!Ab', { policy: 'strict' }), 'Password must be at least 14 characters and include uppercase, lowercase, number, and symbol.');
|
||||
});
|
||||
|
||||
test('password strength supports custom category requirements', () => {
|
||||
const requirements = {
|
||||
minimumLength: 8,
|
||||
minimumCategories: 2,
|
||||
requireUppercase: true,
|
||||
requireSymbol: true
|
||||
};
|
||||
|
||||
assert.equal(validatePasswordStrength('password1!', requirements), 'Password must be at least 8 characters and include uppercase, symbol.');
|
||||
assert.equal(validatePasswordStrength('Password!', requirements), '');
|
||||
});
|
||||
Reference in New Issue
Block a user