mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
fmt files damn son
This commit is contained in:
+25
-11
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user