From 303d927e8b1c5ca959b58c28b0815ac23b5c1e8b Mon Sep 17 00:00:00 2001 From: HypeLevels Date: Mon, 1 Nov 2021 13:49:04 +0000 Subject: [PATCH 1/2] feat(tests): added getBans --- tests/helpers/members/ban.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/helpers/members/ban.ts 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 From 0f63a99f9cb099a1033be3d98078c3f047ceb9af Mon Sep 17 00:00:00 2001 From: HypeLevels Date: Mon, 1 Nov 2021 14:06:47 +0000 Subject: [PATCH 2/2] feat(tests): added tests to mod.ts --- tests/mod.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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, + }), ]); });