mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 01:10:07 +00:00
Merge pull request #813 from TriForMine/main
fix(tests): higher max delay
This commit is contained in:
@@ -16,7 +16,7 @@ Deno.test({
|
||||
// Assertions
|
||||
assertExists(category);
|
||||
// Delay the execution by 5 seconds to allow CHANNEL_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.channels.has(category.id));
|
||||
delayUntil(10000, () => cache.channels.has(category.id));
|
||||
|
||||
if (!cache.channels.has(category.id)) {
|
||||
throw new Error(
|
||||
@@ -34,7 +34,7 @@ Deno.test({
|
||||
),
|
||||
);
|
||||
// Delay the execution by 5 seconds to allow CHANNEL_CREATE event to be processed
|
||||
delayUntil(3000, () => channels.every((c) => cache.channels.has(c.id)));
|
||||
delayUntil(10000, () => channels.every((c) => cache.channels.has(c.id)));
|
||||
|
||||
// If every channel is not present in the cache, error out
|
||||
if (!channels.every((c) => cache.channels.has(c.id))) {
|
||||
|
||||
@@ -16,7 +16,7 @@ async function ifItFailsBlameWolf(options: CreateGuildChannel, save = false) {
|
||||
if (save) tempData.channelId = channel.id;
|
||||
|
||||
// Delay the execution by 5 seconds to allow CHANNEL_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.channels.has(channel.id));
|
||||
delayUntil(10000, () => cache.channels.has(channel.id));
|
||||
|
||||
if (!cache.channels.has(channel.id)) {
|
||||
throw new Error("The channel seemed to be created but it was not cached.");
|
||||
|
||||
@@ -42,7 +42,7 @@ Deno.test({
|
||||
name: "delete-channel",
|
||||
});
|
||||
// wait 5 seconds to give it time for CHANNEL_CREATE event
|
||||
delayUntil(3000, () => cache.channels.has(channel.id));
|
||||
delayUntil(10000, () => cache.channels.has(channel.id));
|
||||
// Make sure the channel was created.
|
||||
if (!cache.channels.has(channel.id)) {
|
||||
throw new Error(
|
||||
@@ -53,7 +53,7 @@ Deno.test({
|
||||
// Delete the channel now without a reason
|
||||
await deleteChannel(tempData.guildId, channel.id, "with a reason");
|
||||
// wait 5 seconds to give it time for CHANNEL_DELETE event
|
||||
delayUntil(3000, () => !cache.channels.has(channel.id));
|
||||
delayUntil(10000, () => !cache.channels.has(channel.id));
|
||||
// Make sure it is gone from cache
|
||||
if (cache.channels.has(channel.id)) {
|
||||
throw new Error(
|
||||
|
||||
@@ -17,7 +17,7 @@ Deno.test({
|
||||
tempData.guildId = guild.id;
|
||||
|
||||
// Delay the execution by 5 seconds to allow GUILD_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.guilds.has(guild.id));
|
||||
delayUntil(10000, () => cache.guilds.has(guild.id));
|
||||
|
||||
if (!cache.guilds.has(guild.id)) {
|
||||
throw new Error("The guild seemed to be created but it was not cached.");
|
||||
|
||||
@@ -14,7 +14,7 @@ Deno.test({
|
||||
}
|
||||
|
||||
await deleteServer(tempData.guildId);
|
||||
delayUntil(3000, () => cache.guilds.has(tempData.guildId));
|
||||
delayUntil(10000, () => cache.guilds.has(tempData.guildId));
|
||||
|
||||
if (cache.guilds.has(tempData.guildId)) {
|
||||
throw new Error("The guild was not able to be deleted.");
|
||||
|
||||
@@ -14,7 +14,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", custom = false) {
|
||||
assertExists(message);
|
||||
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
@@ -45,7 +45,10 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", custom = false) {
|
||||
await message.addReaction(emojiId);
|
||||
}
|
||||
|
||||
delayUntil(3000, () => cache.messages.get(message.id)?.reactions?.length > 0);
|
||||
delayUntil(
|
||||
10000,
|
||||
() => cache.messages.get(message.id)?.reactions?.length > 0,
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
await cache.messages
|
||||
|
||||
@@ -14,7 +14,7 @@ async function ifItFailsBlameWolf(
|
||||
assertExists(message);
|
||||
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
@@ -61,7 +61,10 @@ async function ifItFailsBlameWolf(
|
||||
await message.addReactions(emojiIds, ordered);
|
||||
}
|
||||
|
||||
delayUntil(3000, () => cache.messages.get(message.id)?.reactions?.length > 0);
|
||||
delayUntil(
|
||||
10000,
|
||||
() => cache.messages.get(message.id)?.reactions?.length === 2,
|
||||
);
|
||||
|
||||
assertEquals(await cache.messages.get(message.id)?.reactions?.length, 2);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
|
||||
assertExists(channel);
|
||||
// Wait few seconds for the channel create event to arrive and cache it
|
||||
delayUntil(3000, () => cache.channels.has(channel.id));
|
||||
delayUntil(10000, () => cache.channels.has(channel.id));
|
||||
|
||||
const message = type === "raw"
|
||||
? await sendMessage(channel.id, "Hello World!")
|
||||
@@ -22,7 +22,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
assertExists(message);
|
||||
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
|
||||
@@ -11,7 +11,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", reason?: string) {
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
// Make sure the message was created.
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
@@ -25,7 +25,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", reason?: string) {
|
||||
}
|
||||
|
||||
// Wait 5 seconds to give it time for MESSAGE_DELETE event
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
// Make sure it is gone from cache
|
||||
if (cache.messages.has(message.id)) {
|
||||
throw new Error(
|
||||
|
||||
@@ -9,7 +9,7 @@ async function ifItFailsBlameWolf(reason?: string) {
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
// Make sure the message was created.
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
@@ -20,7 +20,7 @@ async function ifItFailsBlameWolf(reason?: string) {
|
||||
// Assertions
|
||||
assertExists(secondMessage);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(secondMessage.id));
|
||||
delayUntil(10000, () => cache.messages.has(secondMessage.id));
|
||||
// Make sure the message was created.
|
||||
if (!cache.messages.has(secondMessage.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
@@ -35,7 +35,7 @@ async function ifItFailsBlameWolf(reason?: string) {
|
||||
|
||||
// Wait 5 seconds to give it time for MESSAGE_DELETE event
|
||||
delayUntil(
|
||||
3000,
|
||||
10000,
|
||||
() =>
|
||||
!cache.messages.has(message.id) && !cache.messages.has(secondMessage.id),
|
||||
);
|
||||
|
||||
@@ -11,7 +11,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
// Make sure the message was created.
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
@@ -25,7 +25,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
}
|
||||
// Wait 5 seconds to give it time for MESSAGE_UPDATE event
|
||||
delayUntil(
|
||||
3000,
|
||||
10000,
|
||||
() => cache.messages.get(message.id)?.content === "Goodbye World!",
|
||||
);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Deno.test({
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
// Make sure the message was created.
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
|
||||
@@ -22,7 +22,7 @@ Deno.test({
|
||||
assertExists(thirdMessage);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(
|
||||
3000,
|
||||
10000,
|
||||
() =>
|
||||
cache.messages.has(message.id) &&
|
||||
cache.messages.has(secondMessage.id) &&
|
||||
|
||||
@@ -11,7 +11,7 @@ Deno.test({
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
// Make sure the message was created.
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
|
||||
@@ -11,7 +11,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
assertExists(message);
|
||||
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
|
||||
@@ -14,7 +14,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
// Make sure the message was created.
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
@@ -24,7 +24,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
await addReactions(message.channelId, message.id, ["❤", "😃", "🤫"]);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed
|
||||
delayUntil(
|
||||
3000,
|
||||
10000,
|
||||
() => cache.messages.get(message.id)?.reactions?.length === 3,
|
||||
);
|
||||
|
||||
@@ -39,7 +39,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_REMOVE_ALL event to be processed
|
||||
delayUntil(
|
||||
3000,
|
||||
10000,
|
||||
() => cache.messages.get(message.id)?.reactions === undefined,
|
||||
);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
// Make sure the message was created.
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
@@ -19,7 +19,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
await addReaction(message.channelId, message.id, "❤");
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed
|
||||
delayUntil(
|
||||
3000,
|
||||
10000,
|
||||
() => cache.messages.get(message.id)?.reactions?.length === 1,
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_REMOVE_ALL event to be processed
|
||||
delayUntil(
|
||||
3000,
|
||||
10000,
|
||||
() => cache.messages.get(message.id)?.reactions === undefined,
|
||||
);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
// Make sure the message was created.
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
@@ -24,7 +24,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
await addReaction(message.channelId, message.id, "❤");
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed
|
||||
delayUntil(
|
||||
3000,
|
||||
10000,
|
||||
() => cache.messages.get(message.id)?.reactions?.length === 1,
|
||||
);
|
||||
|
||||
@@ -39,7 +39,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_REMOVE_ALL event to be processed
|
||||
delayUntil(
|
||||
3000,
|
||||
10000,
|
||||
() => cache.messages.get(message.id)?.reactions === undefined,
|
||||
);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
// Assertions
|
||||
assertExists(message);
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
// Make sure the message was created.
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
@@ -24,7 +24,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
await addReaction(message.channelId, message.id, "❤");
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed
|
||||
delayUntil(
|
||||
3000,
|
||||
10000,
|
||||
() => cache.messages.get(message.id)?.reactions?.length === 1,
|
||||
);
|
||||
|
||||
@@ -44,7 +44,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_REMOVE_ALL event to be processed
|
||||
delayUntil(
|
||||
3000,
|
||||
10000,
|
||||
() => cache.messages.get(message.id)?.reactions === undefined,
|
||||
);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
|
||||
assertExists(message);
|
||||
|
||||
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
|
||||
delayUntil(3000, () => cache.messages.has(message.id));
|
||||
delayUntil(10000, () => cache.messages.has(message.id));
|
||||
|
||||
if (!cache.messages.has(message.id)) {
|
||||
throw new Error("The message seemed to be sent but it was not cached.");
|
||||
|
||||
Reference in New Issue
Block a user