mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 22:16:13 +00:00
chore: created simple command class method unit test
This commit is contained in:
1 parent
b73dee52ad
commit
aa37704331
1 file changed
+36
@@ -0,0 +1,36 @@
|
||||
import helpCommand from '../interactions/commands/info/help';
|
||||
import { SlashCommandNumberOption } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../classes/interactions';
|
||||
|
||||
describe('HelpCommand', () => {
|
||||
describe('getCommandParams', () => {
|
||||
it('should return the correct command params', () => {
|
||||
const command = {
|
||||
data: {
|
||||
options: [
|
||||
new SlashCommandNumberOption()
|
||||
.setName('optionname')
|
||||
.setDescription('optionDescription')
|
||||
.setRequired(true)
|
||||
]
|
||||
}
|
||||
} as unknown as BaseSlashCommandInteraction;
|
||||
|
||||
const commandParams = helpCommand['getCommandParams'](command);
|
||||
|
||||
expect(commandParams).toBe('**`optionname`** ');
|
||||
});
|
||||
|
||||
it('should return an empty string when no options are present', () => {
|
||||
const command = {
|
||||
data: {
|
||||
options: []
|
||||
}
|
||||
} as unknown as BaseSlashCommandInteraction;
|
||||
|
||||
const commandParams = helpCommand['getCommandParams'](command);
|
||||
|
||||
expect(commandParams).toBe('');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user