mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
27 lines
763 B
TypeScript
27 lines
763 B
TypeScript
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,
|
|
});
|