2023-03-25 15:16:01 +00:00
|
|
|
import { PermissionsBitField, SlashCommandBuilder } from "discord.js";
|
|
|
|
import Timeout from "../../src/commands/timeout";
|
|
|
|
|
|
|
|
describe('Constructor', () => {
|
|
|
|
test('Expect CommandBuilder to be configured', () => {
|
|
|
|
const command = new Timeout();
|
|
|
|
|
|
|
|
expect(command.CommandBuilder).toBeDefined();
|
|
|
|
|
|
|
|
const commandBuilder = command.CommandBuilder as SlashCommandBuilder;
|
|
|
|
|
|
|
|
expect(commandBuilder.name).toBe("timeout");
|
|
|
|
expect(commandBuilder.description).toBe("Timeouts a user out, sending them a DM with the reason if possible");
|
|
|
|
expect(commandBuilder.options.length).toBe(3);
|
|
|
|
});
|
2023-03-27 18:25:10 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('execute', () => {
|
|
|
|
test.todo('Given targetUser is null, Expect validation error');
|
|
|
|
test.todo('Given targetUser.user is null, Expect validation error');
|
|
|
|
test.todo('Given targetUser.member is null, Expect validation error');
|
|
|
|
|
|
|
|
describe('Null checks', () => {
|
|
|
|
describe('GIVEN interaction.guild IS NULL', () => {
|
|
|
|
test.todo('EXPECT nothing to happen');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN interaction.guildId IS NULL', () => {
|
|
|
|
test.todo('EXPECT nothing to happen');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Validation checks', () => {
|
|
|
|
describe('targetUser', () => {
|
|
|
|
describe('GIVEN targetUser IS NULL', () => {
|
|
|
|
test.todo('EXPECT validation error');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN targetUser.user IS NULL', () => {
|
|
|
|
test.todo('EXPECT validation error');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN targetUser.member IS NULL', () => {
|
|
|
|
test.todo('EXPECT validation error');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('lengthInput', () => {
|
|
|
|
describe('GIVEN lengthInput IS NULL', () => {
|
|
|
|
test.todo('EXPECT validation error');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN lengthInput.value IS NULL', () => {
|
|
|
|
test.todo('EXPECT validation error');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN targetMember IS NOT manageable by the bot', () => {
|
|
|
|
test.todo('EXPECT insufficient permissions error');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('targetMember.timeout', () => {
|
|
|
|
test.todo('EXPECT to be ran with time length');
|
|
|
|
|
|
|
|
describe('GIVEN reason IS NOT NULL', () => {
|
|
|
|
test.todo('EXPECT to be ran with reason set');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN reason IS NULL', () => {
|
|
|
|
test.todo('EXPECT to be ran with empty string');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Log Embed', () => {
|
|
|
|
test.todo('EXPECT moderator to be current user');
|
|
|
|
|
|
|
|
test.todo('EXPECT length to be length');
|
|
|
|
|
|
|
|
test.todo('EXPECT until to be until date');
|
|
|
|
|
|
|
|
describe('GIVEN reason IS NULL', () => {
|
|
|
|
test.todo('EXPECT reason to be "*none*"');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN reason IS NOT NULL', () => {
|
|
|
|
test.todo('EXPECT reason to be set to reason');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN channelName IS NULL', () => {
|
|
|
|
test.todo('EXPECT execution to return');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN channel IS NULL', () => {
|
|
|
|
test.todo('EXPECT embed to not be sent');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN channel IS NOT NULL', () => {
|
|
|
|
test.todo('EXPECT logEmbed to be sent to channel');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Audit', () => {
|
|
|
|
test.todo('EXPECT audit to be saved');
|
|
|
|
|
|
|
|
describe('GIVEN reason IS NULL', () => {
|
|
|
|
test.todo('EXPECT audit entity to set reason to "*none*"');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN reason IS NOT NULL', () => {
|
|
|
|
test.todo('EXPECT audit entity to set reason to reason');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('DM User', () => {
|
|
|
|
|
|
|
|
describe('GIVEN user can be messaged', () => {
|
|
|
|
test.todo('EXPECT embed to be sent');
|
|
|
|
|
|
|
|
test.todo('EXPECT length to be in fields');
|
|
|
|
|
|
|
|
test.todo('EXPECT until to be in fields');
|
|
|
|
|
|
|
|
test.todo('EXPECT resultEmbed to contain "DM Sent = true"');
|
|
|
|
|
|
|
|
describe('GIVEN reason IS NULL', () => {
|
|
|
|
test.todo('EXPECT reason to be "*none*"');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN reason IS NOT NULL', () => {
|
|
|
|
test.todo('EXPECT reason to be set to reason');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GIVEN user can NOT be messaged', () => {
|
|
|
|
test.todo('EXPECT resultEmbed to contain "DM Sent = false"');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Result Embed', () => {
|
|
|
|
test.todo('EXPECT resultEmbed to be sent to current channel');
|
|
|
|
|
|
|
|
test.todo('EXPECT embed description to be set to "You have been timed out in (GUILD NAME)');
|
|
|
|
});
|
2023-03-25 15:16:01 +00:00
|
|
|
});
|