Skip to content

Commit

Permalink
fix: minor bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilan Kushnir committed Nov 27, 2024
1 parent 06a1e48 commit feaed48
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/unit/matchers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ describe('uppercaseMatcher', () => {
it('should return a match for missing uppercase letters', () => {
const result = uppercaseMatcher.Matching.prototype.match({ password: 'password123!' });
expect(result).to.deep.include({ pattern: 'uppercaseRequired', token: 'password123!', i: 0, j: 11 });
expect(customMatchersTranslations.warnings.uppercaseRequired).to.equal('At least one uppercase letter is required.');
expect(customMatchersTranslations.warnings.uppercaseRequired).to.equal(
'At least one uppercase letter is required.',
);
expect(customMatchersTranslations.suggestions.uppercaseRequired).to.equal('Include at least one uppercase letter.');
});

Expand All @@ -22,7 +24,9 @@ describe('lowercaseMatcher', () => {
it('should return a match for missing lowercase letters', () => {
const result = lowercaseMatcher.Matching.prototype.match({ password: 'PASSWORD123!' });
expect(result).to.deep.include({ pattern: 'lowercaseRequired', token: 'PASSWORD123!', i: 0, j: 11 });
expect(customMatchersTranslations.warnings.lowercaseRequired).to.equal('At least one lowercase letter is required.');
expect(customMatchersTranslations.warnings.lowercaseRequired).to.equal(
'At least one lowercase letter is required.',
);
expect(customMatchersTranslations.suggestions.lowercaseRequired).to.equal('Include at least one lowercase letter.');
});

Expand Down Expand Up @@ -71,7 +75,9 @@ describe('minLengthMatcher', () => {
const result = matcher.Matching.prototype.match({ password: 'short' });
expect(result).to.deep.include({ pattern: 'minLength', token: 'short', i: 0, j: 4 });
expect(customMatchersTranslations.warnings.minLength).to.equal('Password must be at least 12 characters long.');
expect(customMatchersTranslations.suggestions.minLength).to.equal('Password may not be shorter than 12 characters.');
expect(customMatchersTranslations.suggestions.minLength).to.equal(
'Password may not be shorter than 12 characters.',
);
});

it('should return no matches for passwords meeting the minimum length', () => {
Expand Down

0 comments on commit feaed48

Please sign in to comment.