Add targetMember is not manageable test
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
4d75a11016
commit
c387eb5b02
1 changed files with 42 additions and 1 deletions
|
@ -348,7 +348,48 @@ describe('execute', () => {
|
||||||
expect(interaction.reply).toBeCalledWith('Fields are required.');
|
expect(interaction.reply).toBeCalledWith('Fields are required.');
|
||||||
});
|
});
|
||||||
|
|
||||||
test.todo('GIVEN targetMember IS NOT manageable by the bot, EXPECT insufficient permissions error');
|
test('GIVEN targetMember IS NOT manageable by the bot, EXPECT insufficient permissions error', async () => {
|
||||||
|
const command = new Timeout();
|
||||||
|
|
||||||
|
const interaction = {
|
||||||
|
reply: jest.fn(),
|
||||||
|
guild: mock<Guild>(),
|
||||||
|
guildId: 'guildId',
|
||||||
|
user: {
|
||||||
|
id: 'moderatorId',
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
get: jest.fn((value: string): CommandInteractionOption<CacheType> | null => {
|
||||||
|
switch (value) {
|
||||||
|
case 'target':
|
||||||
|
return {
|
||||||
|
user: {
|
||||||
|
id: 'userId',
|
||||||
|
tag: 'userTag',
|
||||||
|
} as User,
|
||||||
|
member: {
|
||||||
|
manageable: false,
|
||||||
|
} as GuildMember
|
||||||
|
} as CommandInteractionOption;
|
||||||
|
case 'length':
|
||||||
|
return {
|
||||||
|
value: '1m',
|
||||||
|
} 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('Insufficient bot permissions. Please contact a moderator.');
|
||||||
|
});
|
||||||
|
|
||||||
// Reason variable
|
// Reason variable
|
||||||
test.todo('GIVEN reason IS NOT NULL, EXPECT to be ran with reason set');
|
test.todo('GIVEN reason IS NOT NULL, EXPECT to be ran with reason set');
|
||||||
|
|
Loading…
Reference in a new issue