Files
discordeno/tests/helpers/guilds/editGuild.ts
2021-11-10 20:35:03 +00:00

26 lines
852 B
TypeScript

import { Bot } from "../../../src/bot.ts";
import { CreateGuildChannel } from "../../../src/types/guilds/create_guild_channel.ts";
import { DiscordChannelTypes } from "../../../src/types/mod.ts";
import { assertExists, assertEquals } from "../../deps.ts";
import { delayUntil } from "../../utils.ts";
export async function editGuildTests(bot: Bot, guildId: bigint, t: Deno.TestContext) {
const guild = await bot.helpers.editGuild(
guildId,
{
name: "Discordeno Test 1.0",
},
0
);
// Assertions
assertExists(guild);
// Delay the execution to allow event to be processed
// await delayUntil(10000, async () => bot.cache.guilds.get(guild.id)?.name === "Discordeno Test 1.0");
// if (!bot.cache.guilds.has(guild.id)) {
// throw new Error(`The guild seemed to be edited but the cache didn't got updated.`);
// }
}