fix(tests): higher max delay

This commit is contained in:
TriForMine
2021-04-10 23:54:56 +02:00
parent 0739826e7a
commit aae106ab71
20 changed files with 37 additions and 37 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ Deno.test({
// Assertions // Assertions
assertExists(category); assertExists(category);
// Delay the execution by 5 seconds to allow CHANNEL_CREATE event to be processed // 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)) { if (!cache.channels.has(category.id)) {
throw new Error( throw new Error(
@@ -34,7 +34,7 @@ Deno.test({
), ),
); );
// Delay the execution by 5 seconds to allow CHANNEL_CREATE event to be processed // 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 every channel is not present in the cache, error out
if (!channels.every((c) => cache.channels.has(c.id))) { if (!channels.every((c) => cache.channels.has(c.id))) {
+1 -1
View File
@@ -16,7 +16,7 @@ async function ifItFailsBlameWolf(options: CreateGuildChannel, save = false) {
if (save) tempData.channelId = channel.id; if (save) tempData.channelId = channel.id;
// Delay the execution by 5 seconds to allow CHANNEL_CREATE event to be processed // 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)) { if (!cache.channels.has(channel.id)) {
throw new Error("The channel seemed to be created but it was not cached."); throw new Error("The channel seemed to be created but it was not cached.");
+2 -2
View File
@@ -42,7 +42,7 @@ Deno.test({
name: "delete-channel", name: "delete-channel",
}); });
// wait 5 seconds to give it time for CHANNEL_CREATE event // 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. // Make sure the channel was created.
if (!cache.channels.has(channel.id)) { if (!cache.channels.has(channel.id)) {
throw new Error( throw new Error(
@@ -53,7 +53,7 @@ Deno.test({
// Delete the channel now without a reason // Delete the channel now without a reason
await deleteChannel(tempData.guildId, channel.id, "with a reason"); await deleteChannel(tempData.guildId, channel.id, "with a reason");
// wait 5 seconds to give it time for CHANNEL_DELETE event // 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 // Make sure it is gone from cache
if (cache.channels.has(channel.id)) { if (cache.channels.has(channel.id)) {
throw new Error( throw new Error(
+1 -1
View File
@@ -17,7 +17,7 @@ Deno.test({
tempData.guildId = guild.id; tempData.guildId = guild.id;
// Delay the execution by 5 seconds to allow GUILD_CREATE event to be processed // 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)) { if (!cache.guilds.has(guild.id)) {
throw new Error("The guild seemed to be created but it was not cached."); throw new Error("The guild seemed to be created but it was not cached.");
+1 -1
View File
@@ -14,7 +14,7 @@ Deno.test({
} }
await deleteServer(tempData.guildId); await deleteServer(tempData.guildId);
delayUntil(3000, () => cache.guilds.has(tempData.guildId)); delayUntil(10000, () => cache.guilds.has(tempData.guildId));
if (cache.guilds.has(tempData.guildId)) { if (cache.guilds.has(tempData.guildId)) {
throw new Error("The guild was not able to be deleted."); throw new Error("The guild was not able to be deleted.");
+2 -2
View File
@@ -14,7 +14,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", custom = false) {
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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)) { if (!cache.messages.has(message.id)) {
throw new Error("The message seemed to be sent but it was not cached."); throw new Error("The message seemed to be sent but it was not cached.");
@@ -45,7 +45,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", custom = false) {
await message.addReaction(emojiId); 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( assertEquals(
await cache.messages await cache.messages
+2 -2
View File
@@ -14,7 +14,7 @@ async function ifItFailsBlameWolf(
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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)) { if (!cache.messages.has(message.id)) {
throw new Error("The message seemed to be sent but it was not cached."); throw new Error("The message seemed to be sent but it was not cached.");
@@ -61,7 +61,7 @@ async function ifItFailsBlameWolf(
await message.addReactions(emojiIds, ordered); 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); assertEquals(await cache.messages.get(message.id)?.reactions?.length, 2);
} }
+2 -2
View File
@@ -12,7 +12,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
assertExists(channel); assertExists(channel);
// Wait few seconds for the channel create event to arrive and cache it // 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" const message = type === "raw"
? await sendMessage(channel.id, "Hello World!") ? await sendMessage(channel.id, "Hello World!")
@@ -22,7 +22,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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)) { if (!cache.messages.has(message.id)) {
throw new Error("The message seemed to be sent but it was not cached."); throw new Error("The message seemed to be sent but it was not cached.");
+2 -2
View File
@@ -11,7 +11,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", reason?: string) {
// Assertions // Assertions
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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. // Make sure the message was created.
if (!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."); 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 // 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 // Make sure it is gone from cache
if (cache.messages.has(message.id)) { if (cache.messages.has(message.id)) {
throw new Error( throw new Error(
+3 -3
View File
@@ -9,7 +9,7 @@ async function ifItFailsBlameWolf(reason?: string) {
// Assertions // Assertions
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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. // Make sure the message was created.
if (!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."); throw new Error("The message seemed to be sent but it was not cached.");
@@ -20,7 +20,7 @@ async function ifItFailsBlameWolf(reason?: string) {
// Assertions // Assertions
assertExists(secondMessage); assertExists(secondMessage);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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. // Make sure the message was created.
if (!cache.messages.has(secondMessage.id)) { if (!cache.messages.has(secondMessage.id)) {
throw new Error("The message seemed to be sent but it was not cached."); 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 // Wait 5 seconds to give it time for MESSAGE_DELETE event
delayUntil( delayUntil(
3000, 10000,
() => () =>
!cache.messages.has(message.id) && !cache.messages.has(secondMessage.id), !cache.messages.has(message.id) && !cache.messages.has(secondMessage.id),
); );
+2 -2
View File
@@ -11,7 +11,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
// Assertions // Assertions
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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. // Make sure the message was created.
if (!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."); 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 // Wait 5 seconds to give it time for MESSAGE_UPDATE event
delayUntil( delayUntil(
3000, 10000,
() => cache.messages.get(message.id)?.content === "Goodbye World!", () => cache.messages.get(message.id)?.content === "Goodbye World!",
); );
+1 -1
View File
@@ -11,7 +11,7 @@ Deno.test({
// Assertions // Assertions
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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. // Make sure the message was created.
if (!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."); throw new Error("The message seemed to be sent but it was not cached.");
+1 -1
View File
@@ -22,7 +22,7 @@ Deno.test({
assertExists(thirdMessage); assertExists(thirdMessage);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed
delayUntil( delayUntil(
3000, 10000,
() => () =>
cache.messages.has(message.id) && cache.messages.has(message.id) &&
cache.messages.has(secondMessage.id) && cache.messages.has(secondMessage.id) &&
+1 -1
View File
@@ -11,7 +11,7 @@ Deno.test({
// Assertions // Assertions
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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. // Make sure the message was created.
if (!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."); throw new Error("The message seemed to be sent but it was not cached.");
+1 -1
View File
@@ -11,7 +11,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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)) { if (!cache.messages.has(message.id)) {
throw new Error("The message seemed to be sent but it was not cached."); throw new Error("The message seemed to be sent but it was not cached.");
+3 -3
View File
@@ -14,7 +14,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
// Assertions // Assertions
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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. // Make sure the message was created.
if (!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."); 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, ["❤", "😃", "🤫"]); await addReactions(message.channelId, message.id, ["❤", "😃", "🤫"]);
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed // Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed
delayUntil( delayUntil(
3000, 10000,
() => cache.messages.get(message.id)?.reactions?.length === 3, () => 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 // Delay the execution by 5 seconds to allow MESSAGE_REACTION_REMOVE_ALL event to be processed
delayUntil( delayUntil(
3000, 10000,
() => cache.messages.get(message.id)?.reactions === undefined, () => cache.messages.get(message.id)?.reactions === undefined,
); );
+3 -3
View File
@@ -9,7 +9,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
// Assertions // Assertions
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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. // Make sure the message was created.
if (!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."); 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, "❤"); await addReaction(message.channelId, message.id, "❤");
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed // Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed
delayUntil( delayUntil(
3000, 10000,
() => cache.messages.get(message.id)?.reactions?.length === 1, () => 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 // Delay the execution by 5 seconds to allow MESSAGE_REACTION_REMOVE_ALL event to be processed
delayUntil( delayUntil(
3000, 10000,
() => cache.messages.get(message.id)?.reactions === undefined, () => cache.messages.get(message.id)?.reactions === undefined,
); );
+3 -3
View File
@@ -14,7 +14,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
// Assertions // Assertions
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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. // Make sure the message was created.
if (!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."); 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, "❤"); await addReaction(message.channelId, message.id, "❤");
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed // Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed
delayUntil( delayUntil(
3000, 10000,
() => cache.messages.get(message.id)?.reactions?.length === 1, () => 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 // Delay the execution by 5 seconds to allow MESSAGE_REACTION_REMOVE_ALL event to be processed
delayUntil( delayUntil(
3000, 10000,
() => cache.messages.get(message.id)?.reactions === undefined, () => cache.messages.get(message.id)?.reactions === undefined,
); );
+3 -3
View File
@@ -14,7 +14,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
// Assertions // Assertions
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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. // Make sure the message was created.
if (!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."); 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, "❤"); await addReaction(message.channelId, message.id, "❤");
// Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed // Delay the execution by 5 seconds to allow MESSAGE_REACTION_ALL event to be processed
delayUntil( delayUntil(
3000, 10000,
() => cache.messages.get(message.id)?.reactions?.length === 1, () => 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 // Delay the execution by 5 seconds to allow MESSAGE_REACTION_REMOVE_ALL event to be processed
delayUntil( delayUntil(
3000, 10000,
() => cache.messages.get(message.id)?.reactions === undefined, () => cache.messages.get(message.id)?.reactions === undefined,
); );
+1 -1
View File
@@ -11,7 +11,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw") {
assertExists(message); assertExists(message);
// Delay the execution by 5 seconds to allow MESSAGE_CREATE event to be processed // 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)) { if (!cache.messages.has(message.id)) {
throw new Error("The message seemed to be sent but it was not cached."); throw new Error("The message seemed to be sent but it was not cached.");