mirror of
https://github.com/discordjs/discord.js.git
synced 2026-07-21 21:52:57 +00:00
fix(builders): require select menu max_values to be at least 1 (#11565)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -150,6 +150,9 @@ describe('Select Menu Components', () => {
|
||||
test('GIVEN invalid inputs THEN Select Menu does throw', () => {
|
||||
expect(() => selectMenu().setCustomId(longStr).toJSON()).toThrowError();
|
||||
expect(() => selectMenuWithId().setMaxValues(30).toJSON()).toThrowError();
|
||||
expect(() =>
|
||||
selectMenuWithId().setMaxValues(0).addOptions({ label: 'test', value: 'test' }).toJSON(),
|
||||
).toThrowError();
|
||||
expect(() => selectMenuWithId().setMinValues(-20).toJSON()).toThrowError();
|
||||
// @ts-expect-error: Invalid disabled value
|
||||
expect(() => selectMenuWithId().setDisabled(0).toJSON()).toThrowError();
|
||||
|
||||
@@ -63,7 +63,7 @@ const selectMenuBasePredicate = z.object({
|
||||
id: idPredicate,
|
||||
placeholder: z.string().max(150).optional(),
|
||||
min_values: z.number().min(0).max(25).optional(),
|
||||
max_values: z.number().min(0).max(25).optional(),
|
||||
max_values: z.number().min(1).max(25).optional(),
|
||||
custom_id: customIdPredicate,
|
||||
disabled: z.boolean().optional(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user