Files
discordeno/tests/webhook/deleteWebhookWithToken.test.ts
ITOH 03996c5f58 refactor: revert "feat: base plugin lib idea (#2308)" (#2336)
* Revert "feat: base plugin lib idea (#2308)"

This reverts commit ffe7cdbc6f.

* fmt
2022-07-02 14:24:43 +01:00

27 lines
839 B
TypeScript

import { assertEquals, assertExists } from "../deps.ts";
import { loadBot } from "../mod.ts";
import { CACHED_COMMUNITY_GUILD_ID } from "../utils.ts";
Deno.test({
name: "[webhook] delete a webhook",
fn: async () => {
const bot = loadBot();
const channel = await bot.helpers.createChannel(CACHED_COMMUNITY_GUILD_ID, { name: "deleteWebhook" });
assertExists(channel?.id);
const webhook = await bot.helpers.createWebhook(channel.id, { name: "delete" });
assertExists(webhook?.id);
assertExists(webhook.token);
await bot.helpers.deleteWebhookWithToken(webhook.id, webhook.token);
// Fetch the webhook to validate it was deleted
const deletedWebhook = await bot.helpers.getWebhook(webhook.id);
assertEquals(deletedWebhook, undefined);
await bot.helpers.deleteChannel(channel.id);
},
});