mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
fix: minimum 2 characters for custom emojis
This commit is contained in:
@@ -26,7 +26,17 @@ describe('Button Components', () => {
|
||||
.setCustomId('custom')
|
||||
.setLabel('test')
|
||||
.setDisabled(true)
|
||||
.setEmoji({ name: 'test' });
|
||||
.setEmoji({ name: '🩵' });
|
||||
|
||||
button.toJSON();
|
||||
}).not.toThrowError();
|
||||
|
||||
expect(() => {
|
||||
const button = new PrimaryButtonBuilder()
|
||||
.setCustomId('custom')
|
||||
.setLabel('test')
|
||||
.setDisabled(true)
|
||||
.setEmoji({ id: '1234567890123456', name: 'test', animated: true });
|
||||
|
||||
button.toJSON();
|
||||
}).not.toThrowError();
|
||||
@@ -37,7 +47,7 @@ describe('Button Components', () => {
|
||||
}).not.toThrowError();
|
||||
|
||||
expect(() => {
|
||||
const button = new DangerButtonBuilder().setCustomId('custom').setEmoji({ name: 'ok' });
|
||||
const button = new DangerButtonBuilder().setCustomId('custom').setEmoji({ name: '👌' });
|
||||
button.toJSON();
|
||||
}).not.toThrowError();
|
||||
|
||||
@@ -47,7 +57,7 @@ describe('Button Components', () => {
|
||||
}).not.toThrowError();
|
||||
|
||||
expect(() => {
|
||||
const button = new LinkButtonBuilder().setURL('https://discord.js.org').setEmoji({ name: 'ok' });
|
||||
const button = new LinkButtonBuilder().setURL('https://discord.js.org').setEmoji({ name: '👌' });
|
||||
button.toJSON();
|
||||
}).not.toThrowError();
|
||||
|
||||
@@ -66,7 +76,17 @@ describe('Button Components', () => {
|
||||
|
||||
expect(() => {
|
||||
// @ts-expect-error: Invalid emoji
|
||||
const button = new PrimaryButtonBuilder().setEmoji('test');
|
||||
const button = new PrimaryButtonBuilder().setEmoji('🩵');
|
||||
button.toJSON();
|
||||
}).toThrowError();
|
||||
|
||||
expect(() => {
|
||||
const button = new PrimaryButtonBuilder()
|
||||
.setCustomId('custom')
|
||||
.setLabel('test')
|
||||
.setDisabled(true)
|
||||
.setEmoji({ id: '1234567890123456', name: '1' });
|
||||
|
||||
button.toJSON();
|
||||
}).toThrowError();
|
||||
|
||||
@@ -86,7 +106,7 @@ describe('Button Components', () => {
|
||||
// @ts-expect-error: Invalid parameter for disabled
|
||||
expect(() => new PrimaryButtonBuilder().setCustomId('hi').setDisabled(0).toJSON()).toThrowError();
|
||||
// @ts-expect-error: Invalid emoji
|
||||
expect(() => new PrimaryButtonBuilder().setCustomId('hi').setEmoji('foo').toJSON()).toThrowError();
|
||||
expect(() => new PrimaryButtonBuilder().setCustomId('hi').setEmoji('🩵').toJSON()).toThrowError();
|
||||
|
||||
expect(() =>
|
||||
new LinkButtonBuilder()
|
||||
|
||||
@@ -80,7 +80,7 @@ describe('Select Menu Components', () => {
|
||||
.setLabel('test')
|
||||
.setValue('test')
|
||||
.setDefault(true)
|
||||
.setEmoji({ name: 'test' })
|
||||
.setEmoji({ name: '🩵' })
|
||||
.setDescription('description');
|
||||
expect(() => selectMenuWithId().addOptions(option).toJSON()).not.toThrowError();
|
||||
expect(() => selectMenuWithId().setOptions(option).toJSON()).not.toThrowError();
|
||||
|
||||
Reference in New Issue
Block a user