✨ Improve regex escaping logic in unit test for special characters
This commit is contained in:
@@ -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();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user