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
+25 -11
View File
@@ -1,10 +1,10 @@
import { defaultTestOptions, tempData } from "../ws/start_bot.ts";
import {assertEquals, assertExists} from "../deps.ts";
import { assertEquals, assertExists } from "../deps.ts";
import { cache } from "../../src/cache.ts";
import { delayUntil } from "../util/delay_until.ts";
import {addRole} from "../../src/helpers/roles/add_role.ts";
import {createRole} from "../../src/helpers/roles/create_role.ts";
import {botId} from "../../src/bot.ts";
import { addRole } from "../../src/helpers/roles/add_role.ts";
import { createRole } from "../../src/helpers/roles/create_role.ts";
import { botId } from "../../src/bot.ts";
async function ifItFailsBlameWolf(type: "getter" | "raw", reason?: string) {
const role = await createRole(tempData.guildId, {
@@ -14,7 +14,10 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", 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.`);
@@ -27,15 +30,26 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", reason?: string) {
}
// Delay the execution by 5 seconds to allow GUILD_MEMBER_UPDATE event to be processed
await delayUntil(10000, () => cache.members.get(botId)?.guilds.get(tempData.guildId).roles.includes(role.id));
await delayUntil(
10000,
() =>
cache.members.get(botId)?.guilds.get(tempData.guildId).roles.includes(
role.id,
),
);
assertEquals(cache.members.get(botId)?.guilds.get(tempData.guildId).roles.includes(role.id), true);
assertEquals(
cache.members.get(botId)?.guilds.get(tempData.guildId).roles.includes(
role.id,
),
true,
);
}
Deno.test({
name: "[role] add a role without a reason",
async fn() {
await ifItFailsBlameWolf("raw")
await ifItFailsBlameWolf("raw");
},
...defaultTestOptions,
});
@@ -43,7 +57,7 @@ Deno.test({
Deno.test({
name: "[role] add a role with a reason",
async fn() {
await ifItFailsBlameWolf("raw", "with a reason")
await ifItFailsBlameWolf("raw", "with a reason");
},
...defaultTestOptions,
});
@@ -51,7 +65,7 @@ Deno.test({
Deno.test({
name: "[role] member.addRole() without a reason",
async fn() {
await ifItFailsBlameWolf("getter")
await ifItFailsBlameWolf("getter");
},
...defaultTestOptions,
});
@@ -59,7 +73,7 @@ Deno.test({
Deno.test({
name: "[role] member.addRole() with a reason",
async fn() {
await ifItFailsBlameWolf("getter", "with a reason")
await ifItFailsBlameWolf("getter", "with a reason");
},
...defaultTestOptions,
});