mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 16:57:22 +00:00
Merge pull request #1396 from TriForMine/fp-attempt-9001
[Unit Test] members: fetchMembers
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
|
||||
export async function fetchSingleMemberTest(bot: Bot, guildId: bigint, t: Deno.TestContext) {
|
||||
const fetchedMember = await bot.helpers.fetchMembers(guildId, 0, {
|
||||
userIds: [bot.id],
|
||||
limit: 1,
|
||||
});
|
||||
|
||||
// Assertions
|
||||
assertExists(fetchedMember);
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import "./local.ts";
|
||||
import { getMessageTest } from "./helpers/messages/getMessage.ts";
|
||||
import { addReactionTest } from "./helpers/messages/addReaction.ts";
|
||||
import { editMessageTest } from "./helpers/messages/editMessage.ts";
|
||||
import { fetchSingleMemberTest } from "./helpers/members/fetchMembers.ts";
|
||||
|
||||
Deno.test("[Bot] - Starting Tests", async (t) => {
|
||||
// CHANGE TO TRUE WHEN DEBUGGING SANITIZATION ERRORS
|
||||
@@ -206,5 +207,18 @@ Deno.test("[Bot] - Starting Tests", async (t) => {
|
||||
});
|
||||
});
|
||||
|
||||
// MEMBER TESTS GROUPED
|
||||
await t.step("Members related tests", async (t) => {
|
||||
await Promise.all([
|
||||
t.step({
|
||||
name: "[member] fetch a single member by id",
|
||||
fn: async (t) => {
|
||||
await fetchSingleMemberTest(bot, guild.id, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
await stopBot(bot);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user