mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 17:30:07 +00:00
Revert "[Unit Test] messages: editMessage"
This reverts commit 1a3123011b.
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
import { Bot } from "../../../src/bot.ts";
|
||||
import { assertExists } from "../../deps.ts";
|
||||
import { delayUntil } from "../../utils.ts";
|
||||
|
||||
export async function editMessageTest(bot: Bot, channelId: bigint, t: Deno.TestContext) {
|
||||
const message = await bot.helpers.sendMessage(channelId, "Hello World!");
|
||||
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
// Delay the execution by to allow MESSAGE_CREATE event to be processed
|
||||
await delayUntil(10000, () => bot.cache.messages.has(message.id));
|
||||
// Make sure the message was created.
|
||||
if (!bot.cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached. Reason: ${reason}");
|
||||
}
|
||||
|
||||
// Delete the message now
|
||||
await bot.helpers.editMessage(channelId, message.id, "Goodbye World!");
|
||||
|
||||
// Wait to give it time for MESSAGE_UPDATE event
|
||||
await delayUntil(10000, async () => (await bot.cache.messages.get(message.id))?.content === "Goodbye World!");
|
||||
// Make sure it was edited
|
||||
if ((await bot.cache.messages.get(message.id))?.content !== "Goodbye World!") {
|
||||
throw new Error("The message should have been edited but it was not.");
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import { TOKEN } from "../configs.ts";
|
||||
import { createBot, createEventHandlers, DiscordChannelTypes, startBot, stopBot } from "../mod.ts";
|
||||
import { assertEquals, assertExists } from "./deps.ts";
|
||||
import { deleteMessageWithReasonTest, deleteMessageWithoutReasonTest } from "./helpers/messages/deleteMessage.ts";
|
||||
import { editMessageTest } from "./helpers/messages/editMessage.ts";
|
||||
import { delayUntil } from "./utils.ts";
|
||||
import {
|
||||
sendMessageWithComponents,
|
||||
@@ -119,13 +118,6 @@ Deno.test("[Bot] - Starting Tests", async (t) => {
|
||||
},
|
||||
...sanitizeMode,
|
||||
}),
|
||||
t.step({
|
||||
name: "[message] edit message",
|
||||
fn: async (t) => {
|
||||
await editMessageTest(bot, channel.id, t);
|
||||
},
|
||||
...sanitizeMode,
|
||||
})
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user