pin message tests Closes #1287 #1305 #1306 #1288

This commit is contained in:
Skillz4Killz
2021-10-30 21:26:01 +00:00
committed by GitHub
parent f8a2f40b99
commit 5051c44e0d
2 changed files with 28 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import { Bot } from "../../../src/bot.ts";
import { assertEquals } from "../../deps.ts";
export async function pinMessageTests(bot: Bot, channelId: bigint, messageId: bigint, t: Deno.TestContext) {
let pinned = false;
bot.events.channelPinsUpdate = function (bot, payload) {
if (payload.channelId === channelId) pinned = !pinned;
}
await bot.helpers.pinMessage(channelId, messageId);
assertEquals(true, pinned);
await bot.helpers.unpinMessage(channelId, messageId);
assertEquals(false, pinned);
}