test(api): delete all guilds if the guilds count >= 10

This commit is contained in:
ayntee
2021-01-27 12:15:07 +04:00
parent 4464be4781
commit c46e64d1d5

View File

@@ -4,6 +4,7 @@ import {
deleteServer,
getChannel,
} from "../src/api/handlers/guild.ts";
import { eventHandlers } from "../src/bot.ts";
import {
addReaction,
assertEquals,
@@ -58,6 +59,12 @@ Deno.test({
intents: ["GUILD_MESSAGES", "GUILDS"],
});
eventHandlers.ready = () => {
if (cache.guilds.size >= 10) {
cache.guilds.map((guild) => deleteServer(guild.id));
}
};
// Delay the execution by 5 seconds
await delay(5000);