mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
This commit is contained in:
@@ -2,8 +2,8 @@ import { cache } from "../../src/cache.ts";
|
||||
import { createChannel } from "../../src/helpers/channels/create_channel.ts";
|
||||
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
|
||||
import { delayUntil } from "../util/delay_until.ts";
|
||||
import {editChannel} from "../../src/helpers/channels/edit_channel.ts";
|
||||
import {assertEquals} from "../deps.ts";
|
||||
import { editChannel } from "../../src/helpers/channels/edit_channel.ts";
|
||||
import { assertEquals } from "../deps.ts";
|
||||
|
||||
async function ifItFailsBlameWolf(type: "getter" | "raw", reason?: string) {
|
||||
// Create the necessary channels
|
||||
@@ -15,22 +15,25 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", reason?: string) {
|
||||
// Make sure the channel was created.
|
||||
if (!cache.channels.has(channel.id)) {
|
||||
throw new Error(
|
||||
"The channel should have been created but it is not in the cache.",
|
||||
"The channel should have been created but it is not in the cache.",
|
||||
);
|
||||
}
|
||||
|
||||
// Edit the channel now
|
||||
if (type === "raw") {
|
||||
await editChannel(channel.id, {
|
||||
name: "new-name"
|
||||
name: "new-name",
|
||||
}, reason);
|
||||
} else {
|
||||
await channel.edit({
|
||||
name: "new-name"
|
||||
name: "new-name",
|
||||
});
|
||||
}
|
||||
// wait 5 seconds to give it time for CHANNEL_UPDATE event
|
||||
await delayUntil(3000, () => cache.channels.get(channel.id)?.name === "new-name");
|
||||
await delayUntil(
|
||||
3000,
|
||||
() => cache.channels.get(channel.id)?.name === "new-name",
|
||||
);
|
||||
assertEquals(cache.channels.get(channel.id)?.name, "new-name");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user