mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +01:00
fix: Add idPredicate (#11109)
* fix: `idPredicate` * fix: add test * test: add negative test
This commit is contained in:
@@ -32,4 +32,11 @@ describe('Separator', () => {
|
||||
expect(separator.toJSON()).toEqual({ type: ComponentType.Separator });
|
||||
});
|
||||
});
|
||||
|
||||
describe('Invalid id', () => {
|
||||
test('GIVEN a separator with a set spacing and an invalid set id THEN throws error', () => {
|
||||
const separator = new SeparatorBuilder().setSpacing(SeparatorSpacingSize.Large).setId(-1);
|
||||
expect(() => separator.toJSON()).toThrowError();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,6 +14,11 @@ describe('TextDisplay', () => {
|
||||
expect(textDisplay.toJSON()).toEqual({ type: ComponentType.TextDisplay, content: 'foo' });
|
||||
});
|
||||
|
||||
test('GIVEN a text display with a set content with an invalid id THEN throws error', () => {
|
||||
const textDisplay = new TextDisplayBuilder().setContent('foo').setId(5.5);
|
||||
expect(() => textDisplay.toJSON()).toThrowError();
|
||||
});
|
||||
|
||||
test('GIVEN a text display with a pre-defined content THEN overwritten content THEN return valid toJSON data', () => {
|
||||
const textDisplay = new TextDisplayBuilder({ content: 'foo' });
|
||||
textDisplay.setContent('bar');
|
||||
|
||||
Reference in New Issue
Block a user