mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(contextMenu): Remove regular expression validation (#10994)
* fix: remove regex validation * test: remove incorrect test This is fine to create. * fix: guard against whitespace
This commit is contained in:
@@ -12,8 +12,6 @@ describe('Context Menu Commands', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('GIVEN invalid name THEN throw error', () => {
|
test('GIVEN invalid name THEN throw error', () => {
|
||||||
expect(() => getBuilder().setName('$$$').toJSON()).toThrowError();
|
|
||||||
|
|
||||||
expect(() => getBuilder().setName(' ').toJSON()).toThrowError();
|
expect(() => getBuilder().setName(' ').toJSON()).toThrowError();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ const namePredicate = z
|
|||||||
.string()
|
.string()
|
||||||
.min(1)
|
.min(1)
|
||||||
.max(32)
|
.max(32)
|
||||||
.regex(/^(?:(?: *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}\p{Extended_Pictographic}\p{Emoji_Component}]) *)+$/u);
|
.refine((val) => val.trim().length > 0, {
|
||||||
|
error: 'Must not consist of only whitespace.',
|
||||||
|
});
|
||||||
|
|
||||||
const contextsPredicate = z.array(z.enum(InteractionContextType));
|
const contextsPredicate = z.array(z.enum(InteractionContextType));
|
||||||
const integrationTypesPredicate = z.array(z.enum(ApplicationIntegrationType));
|
const integrationTypesPredicate = z.array(z.enum(ApplicationIntegrationType));
|
||||||
|
|||||||
Reference in New Issue
Block a user