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:
spokodev
2026-07-16 23:39:17 +01:00
committed by GitHub
parent 11a3c033c7
commit e51936771f
2 changed files with 4 additions and 1 deletions
@@ -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(),
});