Merge pull request #1403 from HypeLevels/fp-attempt-9001

feat(tests): added getBans, unban, ban
This commit is contained in:
Skillz4Killz
2021-11-01 11:57:36 -04:00
committed by GitHub
2 changed files with 47 additions and 0 deletions

View File

@@ -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)
}

View File

@@ -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,
}),
]);
});