Create timeout command #302
1 changed files with 34 additions and 1 deletions
|
@ -313,7 +313,40 @@ describe('execute', () => {
|
||||||
expect(interaction.reply).toBeCalledWith('Fields are required.');
|
expect(interaction.reply).toBeCalledWith('Fields are required.');
|
||||||
});
|
});
|
||||||
|
|
||||||
test.todo('GIVEN lengthInput.value IS NULL, EXPECT validation error');
|
test('GIVEN lengthInput.value IS NULL, EXPECT validation error', async () => {
|
||||||
|
const command = new Timeout();
|
||||||
|
|
||||||
|
const interaction = {
|
||||||
|
reply: jest.fn(),
|
||||||
|
guild: mock<Guild>(),
|
||||||
|
guildId: 'guildId',
|
||||||
|
options: {
|
||||||
|
get: jest.fn((value: string): CommandInteractionOption<CacheType> | null => {
|
||||||
|
switch (value) {
|
||||||
|
case 'target':
|
||||||
|
return {
|
||||||
|
user: {} as User,
|
||||||
|
member: {} as GuildMember
|
||||||
|
} as CommandInteractionOption;
|
||||||
|
case 'length':
|
||||||
|
return {
|
||||||
|
value: undefined,
|
||||||
|
} as CommandInteractionOption;
|
||||||
|
case 'reason':
|
||||||
|
return {
|
||||||
|
value: 'Test reason',
|
||||||
|
} as CommandInteractionOption;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
} as unknown as CommandInteraction;
|
||||||
|
|
||||||
|
await command.execute(interaction);
|
||||||
|
|
||||||
|
expect(interaction.reply).toBeCalledWith('Fields are required.');
|
||||||
|
});
|
||||||
|
|
||||||
test.todo('GIVEN targetMember IS NOT manageable by the bot, EXPECT insufficient permissions error');
|
test.todo('GIVEN targetMember IS NOT manageable by the bot, EXPECT insufficient permissions error');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue