Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove accent char check for legal name #47130

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/libs/ValidationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,7 @@ function isValidDisplayName(name: string): boolean {
* Checks that the provided legal name doesn't contain special characters
*/
function isValidLegalName(name: string): boolean {
const hasAccentedChars = !!name.match(CONST.REGEX.ACCENT_LATIN_CHARS);
return CONST.REGEX.ALPHABETIC_AND_LATIN_CHARS.test(name) && !hasAccentedChars;
return CONST.REGEX.ALPHABETIC_AND_LATIN_CHARS.test(name);
daledah marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/ValidationUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,16 @@ describe('ValidationUtils', () => {
expect(ValidationUtils.isValidPersonName('test123$')).toBe(false);
});
});

describe('ValidateLegalName', () => {
test('Valid legal name', () => {
expect(ValidationUtils.isValidLegalName('test name')).toBe(true);
expect(ValidationUtils.isValidLegalName(`X Æ A test`)).toBe(true);
});

test('Invalid legal name', () => {
expect(ValidationUtils.isValidLegalName(`a hyphenated-name`)).toBe(false);
expect(ValidationUtils.isValidLegalName('άλφα')).toBe(false);
});
});
});
Loading