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
+31 -22
View File
@@ -3,43 +3,52 @@ import { assertEquals, assertExists } from "../deps.ts";
import { cache } from "../../src/cache.ts";
import { createEmoji } from "../../src/helpers/emojis/create_emoji.ts";
import { delayUntil } from "../util/delay_until.ts";
import {deleteEmoji} from "../../src/helpers/emojis/delete_emoji.ts";
import { deleteEmoji } from "../../src/helpers/emojis/delete_emoji.ts";
async function ifItFailsBlameWolf(reason?: string) {
const emoji = await createEmoji(
tempData.guildId,
"blamewolf",
"https://cdn.discordapp.com/emojis/814955268123000832.png",
{
name: "blamewolf",
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
roles: [],
}
);
const emoji = await createEmoji(
tempData.guildId,
"blamewolf",
"https://cdn.discordapp.com/emojis/814955268123000832.png",
{
name: "blamewolf",
image: "https://cdn.discordapp.com/emojis/814955268123000832.png",
roles: [],
},
);
assertExists(emoji);
assertExists(emoji);
await delayUntil(10000, () => cache.guilds.get(tempData.guildId)?.emojis?.has(emoji.id));
await delayUntil(
10000,
() => cache.guilds.get(tempData.guildId)?.emojis?.has(emoji.id),
);
await deleteEmoji(tempData.guildId, emoji.id!, reason);
await deleteEmoji(tempData.guildId, emoji.id!, reason);
await delayUntil(10000, () => !cache.guilds.get(tempData.guildId)?.emojis?.has(emoji.id));
await delayUntil(
10000,
() => !cache.guilds.get(tempData.guildId)?.emojis?.has(emoji.id),
);
assertEquals(cache.guilds.get(tempData.guildId)?.emojis?.has(emoji.id), false)
assertEquals(
cache.guilds.get(tempData.guildId)?.emojis?.has(emoji.id),
false,
);
}
Deno.test({
name: "[emoji] delete an emoji without a reason",
async fn() {
await ifItFailsBlameWolf();
await ifItFailsBlameWolf();
},
...defaultTestOptions,
});
Deno.test({
name: "[emoji] delete an emoji with a reason",
async fn() {
await ifItFailsBlameWolf("with a reason");
},
...defaultTestOptions,
name: "[emoji] delete an emoji with a reason",
async fn() {
await ifItFailsBlameWolf("with a reason");
},
...defaultTestOptions,
});