Improve regex escaping logic in unit test for special characters

This commit is contained in:
2026-01-29 03:18:36 +00:00
parent 3c7e84b21a
commit 5bfe7c6078

View File

@@ -312,7 +312,10 @@ describe('useGamemasterSearch', () => {
it('should handle special regex characters gracefully', () => { it('should handle special regex characters gracefully', () => {
const searchTerm = '.*'; const searchTerm = '.*';
const escapedTerm = searchTerm.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`); const escapedTerm = searchTerm.replace(
/[.*+?^${}()|[\]\\]/g,
String.raw`\$&`
);
expect(() => new RegExp(escapedTerm)).not.toThrow(); expect(() => new RegExp(escapedTerm)).not.toThrow();
}); });
}); });