mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
tests: add invites tests (#855)
* tests: add invites tests Co-authored-by: TriForMine <TriForMine@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
|
||||
import { assertEquals } from "../deps.ts";
|
||||
import { getInvites } from "../../src/helpers/invites/get_invites.ts";
|
||||
import { cache } from "../../src/cache.ts";
|
||||
|
||||
async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
let invites;
|
||||
|
||||
if (type === "raw") {
|
||||
invites = await getInvites(tempData.guildId);
|
||||
} else {
|
||||
const guild = cache.guilds.get(tempData.guildId);
|
||||
invites = await guild?.invites();
|
||||
}
|
||||
|
||||
assertEquals((invites?.size || 0) >= 0, true);
|
||||
}
|
||||
|
||||
Deno.test({
|
||||
name: "[invite] get invites",
|
||||
async fn() {
|
||||
await ifItFailsBlameWolf("raw");
|
||||
},
|
||||
...defaultTestOptions,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "[invite] guild.invites()",
|
||||
async fn() {
|
||||
await ifItFailsBlameWolf("getter");
|
||||
},
|
||||
...defaultTestOptions,
|
||||
});
|
||||
Reference in New Issue
Block a user