mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 09:20:08 +00:00
Merge pull request #1403 from HypeLevels/fp-attempt-9001
feat(tests): added getBans, unban, ban
This commit is contained in:
18
tests/helpers/members/ban.ts
Normal file
18
tests/helpers/members/ban.ts
Normal 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)
|
||||
}
|
||||
29
tests/mod.ts
29
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,
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user