diff --git a/tests/helpers/misc/discoveries.ts b/tests/helpers/misc/discoveries.ts new file mode 100644 index 000000000..aa03a281d --- /dev/null +++ b/tests/helpers/misc/discoveries.ts @@ -0,0 +1,14 @@ +import { Bot } from "../../../src/bot.ts"; +import { assertEquals } from "../../deps.ts"; + +export async function getDiscoveryCategoriesTest(bot: Bot, t: Deno.TestContext) { + const categories = await bot.helpers.getDiscoveryCategories(); + + assertEquals(categories.size > 0, true); +} + +export async function validDiscoveryTermTest(bot: Bot, t: Deno.TestContext) { + const valid = await bot.helpers.validDiscoveryTerm("Bots"); + + assertEquals(valid, true); +} diff --git a/tests/mod.ts b/tests/mod.ts index a04eca880..513c98fd7 100644 --- a/tests/mod.ts +++ b/tests/mod.ts @@ -55,6 +55,7 @@ import { getBanTests } from "./helpers/guilds/getBan.ts"; import { getBansTests } from "./helpers/guilds/getBans.ts"; import { getGuildTests } from "./helpers/guilds/getGuild.ts"; import { getVanityURLTests } from "./helpers/guilds/getVanityUrl.ts"; +import { getDiscoveryCategoriesTest, validDiscoveryTermTest } from "./helpers/misc/discoveries.ts"; // CHANGE TO TRUE WHEN DEBUGGING SANITIZATION ERRORS const sanitizeMode = { @@ -765,7 +766,7 @@ Deno.test({ }), ]); }, - }); + }); // SOME MISC TESTS await Promise.all([ @@ -775,23 +776,37 @@ Deno.test({ await getUserTests(bot, t); }, ...sanitizeMode, - }),t.step({ + }), + t.step({ name: "[tranform] snowflake to bigint", fn: async (t) => { assertEquals(130136895395987456n, bot.transformers.snowflake("130136895395987456")); }, - ...sanitizeMode + ...sanitizeMode, }), - // CONDUCT MEMORY BENCHMARK TESTS + t.step({ + name: "[discovery] Validate a discovery search term", + fn: async (t) => { + await validDiscoveryTermTest(bot, t); + }, + ...sanitizeMode, + }), + t.step({ + name: "[discovery] get categories from discovery", + fn: async (t) => { + await getDiscoveryCategoriesTest(bot, t); + }, + ...sanitizeMode, + }), + // CONDUCT MEMORY BENCHMARK TESTS await t.step({ name: "[Memory] Benchmark memory tests", fn: async (t) => { await memoryBenchmarks(bot, true); }, - }) - ]) - + }), + ]); await stopBot(bot); },