From cfb86c454ed957df6e9f7e2c384bebf26bfc72bf Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Sat, 30 Oct 2021 15:41:46 +0000 Subject: [PATCH] enable logs per test --- src/rest/process_request.ts | 1 + tests/mod.ts | 158 ++++++++++++++++++++++-------------- 2 files changed, 96 insertions(+), 63 deletions(-) diff --git a/src/rest/process_request.ts b/src/rest/process_request.ts index 183916efc..cb0358946 100644 --- a/src/rest/process_request.ts +++ b/src/rest/process_request.ts @@ -18,6 +18,7 @@ export function processRequest(rest: RestManager, request: RestRequest, payload: const url = rest.simplifyUrl(request.url, request.method); const queue = rest.pathQueues.get(url); + // console.log('process request', url, Boolean(queue)); // IF THE QUEUE EXISTS JUST ADD THIS TO THE QUEUE if (queue) { queue.requests.push({ request, payload }); diff --git a/tests/mod.ts b/tests/mod.ts index f75886a9a..f2f2fb6b0 100644 --- a/tests/mod.ts +++ b/tests/mod.ts @@ -46,6 +46,8 @@ Deno.test("[Bot] - Starting Tests", async (t) => { await startBot(bot); + // bot.rest.debug = console.log; + // Delay the execution to allow READY events to be processed await delayUntil(10000, () => Boolean(startedAt)); console.log("Bot online"); @@ -90,108 +92,138 @@ Deno.test("[Bot] - Starting Tests", async (t) => { t.step({ name: "[message] send message with text", fn: async (t) => { + console.log('start', 1) await sendMessageWithTextTest(bot, channel.id, t); + console.log('pass', 1) }, ...sanitizeMode, }), t.step({ name: "[message] send message with embeds", fn: async (t) => { + console.log('start', 2) await sendMessageWithEmbedsTest(bot, channel.id, t); + console.log('pass', 2) }, ...sanitizeMode, }), // t.step({ // name: "[message] send message with components", // fn: async (t) => { + // console.log('start', 2.5) // await sendMessageWithComponents(bot, channel.id, t); + // console.log('pass', 2.5) // }, // ...sanitizeMode, // }), t.step({ name: "[message] delete message without a reason", fn: async (t) => { + console.log('start', 3) await deleteMessageWithoutReasonTest(bot, channel.id, t); + console.log('pass', 3) }, ...sanitizeMode, }), t.step({ name: "[message] delete message with a reason", fn: async (t) => { + console.log('start', 4) await deleteMessageWithReasonTest(bot, channel.id, t); + console.log('pass', 4) }, ...sanitizeMode, }), t.step({ name: "[message] delete messages without a reason", fn: async (t) => { + console.log('start', 5) await deleteMessagesWithoutReasonTest(bot, channel.id, t); + console.log('pass', 5) + }, + ...sanitizeMode, + }), + t.step({ + name: "[message] delete messages with a reason", + fn: async (t) => { + console.log('start', 6) + await deleteMessagesWithReasonTest(bot, channel.id, t); + console.log('pass', 6) + }, + ...sanitizeMode, + }), + t.step({ + name: "[message] fetch a message", + fn: async (t) => { + console.log('start', 6.1) + await getMessageTest(bot, channel.id, t); + console.log('pass', 6.1) + }, + ...sanitizeMode, + }), + t.step({ + name: "[message] fetch messages", + fn: async (t) => { + console.log('start', 6.2) + await getMessagesTest(bot, channel.id, t); + console.log('pass', 6.2) + }, + ...sanitizeMode, + }), + t.step({ + name: "[message] add a reaction", + fn: async (t) => { + console.log('start', 7) + await addReactionTest(bot, guild.id, channel.id, { custom: false, single: true, ordered: false }, t); + console.log('pass', 7) + }, + ...sanitizeMode, + }), + t.step({ + name: "[message] add a custom reaction", + fn: async (t) => { + console.log('start', 8) + await addReactionTest(bot, guild.id, channel.id, { custom: true, single: true, ordered: false }, t); + console.log('pass', 8) + }, + ...sanitizeMode, + }), + t.step({ + name: "[message] add multiple reactions", + fn: async (t) => { + console.log('start', 9) + await addReactionTest(bot, guild.id, channel.id, { custom: false, single: false, ordered: false }, t); + console.log('pass', 9) + }, + ...sanitizeMode, + }), + t.step({ + name: "[message] add multiple custom reactions", + fn: async (t) => { + console.log('start', 10) + await addReactionTest(bot, guild.id, channel.id, { custom: true, single: false, ordered: false }, t); + console.log('pass', 10) + }, + ...sanitizeMode, + }), + t.step({ + name: "[message] add multiple reactions in order", + fn: async (t) => { + console.log('start', 11) + await addReactionTest(bot, guild.id, channel.id, { custom: false, single: false, ordered: true }, t); + console.log('pass', 11) + }, + ...sanitizeMode, + }), + t.step({ + name: "[message] add multiple custom reactions in order", + fn: async (t) => { + console.log('start', 12) + await addReactionTest(bot, guild.id, channel.id, { custom: true, single: false, ordered: true }, t); + console.log('pass', 12) }, ...sanitizeMode, }), - // t.step({ - // name: "[message] delete messages with a reason", - // fn: async (t) => { - // await deleteMessagesWithReasonTest(bot, channel.id, t); - // }, - // ...sanitizeMode, - // }), - // t.step({ - // name: "[message] fetch a message", - // fn: async (t) => { - // await getMessageTest(bot, channel.id, t); - // }, - // ...sanitizeMode, - // }), - // t.step({ - // name: "[message] fetch messages", - // fn: async (t) => { - // await getMessagesTest(bot, channel.id, t); - // }, - // ...sanitizeMode, - // }), - // t.step({ - // name: "[message] add a reaction", - // fn: async (t) => { - // await addReactionTest(bot, guild.id, channel.id, { custom: false, single: true, ordered: false }, t); - // }, - // ...sanitizeMode, - // }), - // t.step({ - // name: "[message] add a custom reaction", - // fn: async (t) => { - // await addReactionTest(bot, guild.id, channel.id, { custom: true, single: true, ordered: false }, t); - // }, - // ...sanitizeMode, - // }), - // t.step({ - // name: "[message] add multiple reactions", - // fn: async (t) => { - // await addReactionTest(bot, guild.id, channel.id, { custom: false, single: false, ordered: false }, t); - // }, - // ...sanitizeMode, - // }), - // t.step({ - // name: "[message] add multiple custom reactions", - // fn: async (t) => { - // await addReactionTest(bot, guild.id, channel.id, { custom: true, single: false, ordered: false }, t); - // }, - // ...sanitizeMode, - // }), - // t.step({ - // name: "[message] add multiple reactions in order", - // fn: async (t) => { - // await addReactionTest(bot, guild.id, channel.id, { custom: false, single: false, ordered: true }, t); - // }, - // ...sanitizeMode, - // }), - // t.step({ - // name: "[message] add multiple custom reactions in order", - // fn: async (t) => { - // await addReactionTest(bot, guild.id, channel.id, { custom: true, single: false, ordered: true }, t); - // }, - // ...sanitizeMode, - // }), ]); }); });