tests: add deleteChannel tests

This commit is contained in:
Skillz4Killz
2021-04-09 17:20:41 +00:00
committed by GitHub
parent 16f5293211
commit a44f968745
4 changed files with 90 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
import { cache, createChannel, delay } from "../../mod.ts";
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import { assertEquals, assertExists } from "../deps.ts";
Deno.test({
name: "[channel] create a new channel",
async fn() {
const channel = await createChannel(tempData.guildId, {
name: "Discordeno-test",
});
// Assertions
assertExists(channel);
tempData.channelId = channel.id;
assertEquals(tempData.channelId, channel.id);
// Delay the execution by 5 seconds to allow CHANNEL_CREATE event to be processed
await delay(5000);
if (!cache.channels.has(channel.id)) {
throw new Error("The channel seemed to be created but it was not cached.");
}
},
...defaultTestOptions,
});