fmt files damn son

This commit is contained in:
ayntee
2021-04-12 23:13:37 +04:00
parent fb42d03944
commit 1cbc1b8f82
45 changed files with 443 additions and 281 deletions
+16 -8
View File
@@ -1,9 +1,9 @@
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import {assertExists} from "../deps.ts";
import { assertExists } from "../deps.ts";
import { cache } from "../../src/cache.ts";
import { delayUntil } from "../util/delay_until.ts";
import {createRole} from "../../src/helpers/roles/create_role.ts";
import {deleteRole} from "../../src/helpers/roles/delete_role.ts";
import { createRole } from "../../src/helpers/roles/create_role.ts";
import { deleteRole } from "../../src/helpers/roles/delete_role.ts";
async function ifItFailsBlameWolf(reason?: string) {
const role = await createRole(tempData.guildId, {
@@ -13,7 +13,10 @@ async function ifItFailsBlameWolf(reason?: string) {
assertExists(role);
// Delay the execution by 5 seconds to allow GUILD_ROLE_CREATE event to be processed
await delayUntil(10000, () => cache.guilds.get(tempData.guildId)?.roles.has(role.id));
await delayUntil(
10000,
() => cache.guilds.get(tempData.guildId)?.roles.has(role.id),
);
if (!cache.guilds.get(tempData.guildId)?.roles.has(role.id)) {
throw new Error(`The role seemed to be created but it was not cached.`);
@@ -22,17 +25,22 @@ async function ifItFailsBlameWolf(reason?: string) {
await deleteRole(tempData.guildId, role.id);
// Delay the execution by 5 seconds to allow GUILD_ROLE_CREATE event to be processed
await delayUntil(10000, () => !cache.guilds.get(tempData.guildId)?.roles.has(role.id));
await delayUntil(
10000,
() => !cache.guilds.get(tempData.guildId)?.roles.has(role.id),
);
if (cache.guilds.get(tempData.guildId)?.roles.has(role.id)) {
throw new Error(`The role should have been deleted but it is still in cache.`);
throw new Error(
`The role should have been deleted but it is still in cache.`,
);
}
}
Deno.test({
name: "[role] delete a role without a reason",
async fn() {
await ifItFailsBlameWolf()
await ifItFailsBlameWolf();
},
...defaultTestOptions,
});
@@ -40,7 +48,7 @@ Deno.test({
Deno.test({
name: "[role] delete a role with a reason",
async fn() {
await ifItFailsBlameWolf( "with a reason")
await ifItFailsBlameWolf("with a reason");
},
...defaultTestOptions,
});