Skip to content

Commit

Permalink
fix: remove duplicated regex fro member username
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh committed Nov 21, 2024
1 parent ff411f0 commit 32906aa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
22 changes: 0 additions & 22 deletions src/member/constants.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,6 @@ describe('Member constants', () => {
// prettier-ignore
const validUsername1 = 'Jéàn de l\'Avoiné';

it('username forbidden characters regex', () => {
expect(invalidUsername).toMatch(
MemberConstants.USERNAME_FORBIDDEN_CHARS_REGEX,
);
expect(invalidUsername1).toMatch(
MemberConstants.USERNAME_FORBIDDEN_CHARS_REGEX,
);
expect(invalidUsername2).toMatch(
MemberConstants.USERNAME_FORBIDDEN_CHARS_REGEX,
);
expect(invalidUsername3).toMatch(
MemberConstants.USERNAME_FORBIDDEN_CHARS_REGEX,
);

expect(validUsername).not.toMatch(
MemberConstants.USERNAME_FORBIDDEN_CHARS_REGEX,
);
expect(validUsername1).not.toMatch(
MemberConstants.USERNAME_FORBIDDEN_CHARS_REGEX,
);
});

it('username format regex', () => {
expect(invalidUsername).not.toMatch(MemberConstants.USERNAME_FORMAT_REGEX);
expect(invalidUsername1).not.toMatch(MemberConstants.USERNAME_FORMAT_REGEX);
Expand Down
2 changes: 0 additions & 2 deletions src/member/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export const MemberConstants = {
USERNAME_FORBIDDEN_CHARS_REGEX:
/["<>^%\\\u{0000}-\u{001F}\u{007F}-\u{009F}]+/u,
USERNAME_FORMAT_REGEX: /^[^"<>^%\\\u{0000}-\u{001F}\u{007F}-\u{009F}]+$/u,
};

0 comments on commit 32906aa

Please sign in to comment.