Skip to content

Commit

Permalink
Merge branch 'main' into andrewli-parsecurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
Li357 authored Aug 1, 2023
2 parents 1fe2259 + 56db2a0 commit df708b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions __tests__/Str-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,11 @@ describe('Str.fromCurrencyToNumber', () => {
expect(Str.fromCurrencyToNumber('Bs.S2')).toBe(200);
});
});

describe('Str.isValidEmail', () => {
it('Correctly detects a valid email', () => {
expect(Str.isValidEmail('[email protected]')).toBeTruthy();
expect(Str.isValidEmail('test@gmail')).toBeFalsy();
expect(Str.isValidEmail('usernamelongerthan64charactersshouldnotworkaccordingtorfc822whichisusedbyphp@gmail.com')).toBeFalsy();
});
});
2 changes: 1 addition & 1 deletion lib/CONST.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-useless-escape */

const EMAIL_BASE_REGEX = "([\\w\\-\\+\\'#]+(?:\\.[\\w\\-\\'\\+]+)*@(?:[\\w\\-]+\\.)+[a-z]{2,})";
const EMAIL_BASE_REGEX = "([\\w\\-\\+\\'#]{1,64}(?:\\.[\\w\\-\\'\\+]+)*@(?:[\\w\\-]+\\.)+[a-z]{2,})";

const MOMENT_FORMAT_STRING = 'YYYY-MM-DD';

Expand Down

0 comments on commit df708b5

Please sign in to comment.