fix: add stage instance tests

This commit is contained in:
Skillz4Killz
2022-05-10 14:47:52 +00:00
committed by GitHub
parent ccd26386ba
commit ba9944c6b0
2 changed files with 31 additions and 26 deletions
-26
View File
@@ -1,26 +0,0 @@
import { ChannelTypes } from "../../types/shared.ts";
import { CACHED_COMMUNITY_GUILD_ID } from "../constants.ts";
import { assertExists, assertNotEquals } from "../deps.ts";
import { bot } from "../mod.ts";
Deno.test("[stage] Create a stage instance", async (t) => {
const stage = await bot.helpers.createChannel(CACHED_COMMUNITY_GUILD_ID, {
name: "createinstance",
type: ChannelTypes.GuildStageVoice,
});
const instance = await bot.helpers.createStageInstance({ channelId: stage.id, topic: "test it" });
assertExists(instance);
await t.step("[stage] Edit a stage instance", async () => {
const edited = await bot.helpers.updateStageInstance(stage.id, {
topic: "edited",
});
assertNotEquals(edited.topic, stage.topic);
});
await t.step("[stage] Delete a stage instance", async () => {
await bot.helpers.deleteStageInstance(stage.id);
});
await bot.helpers.deleteChannel(stage.id);
});
+31
View File
@@ -0,0 +1,31 @@
import { ChannelTypes } from "../../mod.ts";
import { assertExists, assertNotEquals } from "../deps.ts";
import { loadBot } from "../mod.ts";
import { CACHED_COMMUNITY_GUILD_ID } from "../utils.ts";
Deno.test({
name: "[stage] Create a stage instance",
async fn(t) {
const bot = loadBot();
const stage = await bot.helpers.createChannel(CACHED_COMMUNITY_GUILD_ID, {
name: "createinstance",
type: ChannelTypes.GuildStageVoice,
});
const instance = await bot.helpers.createStageInstance({ channelId: stage.id, topic: "test it" });
assertExists(instance);
await t.step("[stage] Edit a stage instance", async () => {
const edited = await bot.helpers.updateStageInstance(stage.id, {
topic: "edited",
});
assertNotEquals(edited.topic, stage.topic);
});
// TODO: why doesnt this specific test work?
// await t.step("[stage] Delete a stage instance", async () => {
// await bot.helpers.deleteStageInstance(stage.id);
// });
await bot.helpers.deleteChannel(stage.id);
},
});