Merge pull request #1516 from Skillz4Killz/fp-attempt-9001

add discovery tests
This commit is contained in:
Skillz4Killz
2021-11-03 11:48:57 -04:00
committed by GitHub
2 changed files with 29 additions and 0 deletions
+14
View File
@@ -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);
}
+15
View File
@@ -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 = {
@@ -783,6 +784,20 @@ Deno.test({
},
...sanitizeMode,
}),
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({