mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-18 01:07:22 +00:00
add discovery tests
This commit is contained in:
@@ -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);
|
||||
}
|
||||
+22
-7
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user