diff --git a/tests/helpers/members/ban.ts b/tests/helpers/members/ban.ts new file mode 100644 index 000000000..c08f93c1b --- /dev/null +++ b/tests/helpers/members/ban.ts @@ -0,0 +1,18 @@ +import { Bot } from "../../../src/bot.ts"; +import { CreateGuildBan } from "../../../src/types/mod.ts"; + +export async function banTest(bot: Bot, t: Deno.TestContext, guildId: bigint, id: bigint, options?: CreateGuildBan) { + await bot.helpers.ban(guildId, 456226577798135808n) +} + +export async function getBansTest(bot: Bot, t: Deno.TestContext, guildId: bigint) { + await bot.helpers.getBans(guildId) +} + +export async function banTestWReason(bot: Bot, t: Deno.TestContext, guildId: bigint, id: bigint, options?: CreateGuildBan) { + await bot.helpers.ban(guildId, 456226577798135808n, {reason: "Blame Wolf"}) +} + +export async function unbanTest(bot: Bot, t: Deno.TestContext, guildId: bigint, id: bigint) { + await bot.helpers.unban(guildId, 456226577798135808n) +} \ No newline at end of file diff --git a/tests/mod.ts b/tests/mod.ts index afb100c7b..b85ea07a8 100644 --- a/tests/mod.ts +++ b/tests/mod.ts @@ -38,6 +38,7 @@ import { deleteEmojiWithoutReasonTest, deleteEmojiWithReasonTest } from "./helpe import { editEmojiTest } from "./helpers/emojis/edit_emoji.ts"; import { getEmojiTest } from "./helpers/emojis/get_emoji.ts"; import { getEmojisTest } from "./helpers/emojis/get_emojis.ts"; +import { getBansTest, unbanTest, banTest, banTestWReason } from "./helpers/members/ban.ts"; Deno.test("[Bot] - Starting Tests", async (t) => { // CHANGE TO TRUE WHEN DEBUGGING SANITIZATION ERRORS @@ -521,6 +522,34 @@ Deno.test("[Bot] - Starting Tests", async (t) => { }, ...sanitizeMode, }), + t.step({ + name: "[member] getBans from guild", + fn: async (t) => { + await getBansTest(bot, t, guild.id); + }, + ...sanitizeMode, + }), + t.step({ + name: "[member] unban member from guild", + fn: async (t) => { + await unbanTest(bot, t, guild.id, 456226577798135808n); + }, + ...sanitizeMode, + }), + t.step({ + name: "[member] ban member from guild without reason", + fn: async (t) => { + await banTest(bot, t, guild.id, 456226577798135808n); + }, + ...sanitizeMode, + }), + t.step({ + name: "[member] ban member from guild without reason", + fn: async (t) => { + await banTestWReason(bot, t, guild.id, 456226577798135808n, {reason: "Blame Wolf"}); + }, + ...sanitizeMode, + }), ]); });