Create timeout command #302
1 changed files with 6 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
|||
import { APIEmbed, CommandInteraction, CommandInteractionOption, Embed, Guild, GuildChannel, GuildMember, InteractionReplyOptions, JSONEncodable, SlashCommandBuilder, TextChannel, User } from "discord.js";
|
||||
import { APIEmbed, CommandInteraction, CommandInteractionOption, Embed, EmbedBuilder, Guild, GuildChannel, GuildMember, InteractionReplyOptions, JSONEncodable, SlashCommandBuilder, TextChannel, User } from "discord.js";
|
||||
import { mock } from "jest-mock-extended";
|
||||
import Timeout from "../../src/commands/timeout";
|
||||
import SettingsHelper from "../../src/helpers/SettingsHelper";
|
||||
|
@ -29,7 +29,6 @@ describe('execute', () => {
|
|||
embeds = options.embeds as APIEmbed[];
|
||||
});
|
||||
|
||||
// SettingsHelper.GetSetting = jest.fn().mockResolvedValue('mod-logs');
|
||||
const getSetting = jest.spyOn(SettingsHelper, 'GetSetting').mockResolvedValue('mod-logs');
|
||||
const auditSave = jest.spyOn(Audit.prototype, 'Save').mockImplementation();
|
||||
|
||||
|
@ -91,19 +90,18 @@ describe('execute', () => {
|
|||
expect(embeds!.length).toBe(1);
|
||||
|
||||
// EXPECT resultEmbed to be correctly configured
|
||||
const resultEmbed = embeds![0];
|
||||
const resultEmbed = embeds![0] as EmbedBuilder;
|
||||
|
||||
expect(resultEmbed.description).toBe('<@userId> has been timed out');
|
||||
expect(resultEmbed.fields).toBeDefined();
|
||||
expect(resultEmbed.fields!.length).toBe(1);
|
||||
expect(resultEmbed.data.description).toBe('<@userId> has been timed out');
|
||||
expect(resultEmbed.data.fields).toBeDefined();
|
||||
expect(resultEmbed.data.fields!.length).toBe(1);
|
||||
|
||||
// EXPECT DM field to be configured
|
||||
const resultEmbedDMField = resultEmbed.fields![0];
|
||||
const resultEmbedDMField = resultEmbed.data.fields![0];
|
||||
|
||||
expect(resultEmbedDMField.name).toBe("DM Sent");
|
||||
expect(resultEmbedDMField.value).toBe("true");
|
||||
|
||||
// TODO: User was timed out
|
||||
// TODO: DM Embed check
|
||||
// TODO: Log Embed check
|
||||
// TODO: Audit check
|
||||
|
|
Loading…
Reference in a new issue