nineteenth chunk

This commit is contained in:
ITOH
2021-11-14 18:44:40 +01:00
parent 388e99fa42
commit 9fe7a427b9
2 changed files with 0 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import { Bot } from "../../../src/bot.ts";
import { delayUntil } from "../../utils.ts";
export async function deleteChannelTests(bot: Bot, guildId: bigint, options: { reason?: string }, t: Deno.TestContext) {
// Create the necessary channels
const channel = await bot.helpers.createChannel(guildId, {
name: "delete-channel",
});
await delayUntil(10000, () => bot.cache.channels.has(channel.id));
// Make sure the channel was created.
if (!bot.cache.channels.has(channel.id)) {
throw new Error("The channel should have been created but it is not in the cache.");
}
// Delete the channel now without a reason
await bot.helpers.deleteChannel(channel.id, options.reason);
// wait to give it time for event
await delayUntil(10000, () => !bot.cache.channels.has(channel.id));
// Make sure it is gone from cache
if (bot.cache.channels.has(channel.id)) {
throw new Error("The channel should have been deleted but it is still in cache.");
}
}