@zerospacegg/vynthra
Version:
Discord bot for ZeroSpace.gg data
40 lines (33 loc) • 1.24 kB
text/typescript
import { test } from "node:test";
import assert from "node:assert";
import { createBot } from "../../src/bot/index.js";
import { createMockBotConfig } from "../setup-node.js";
test("Example Test Suite", async (t) => {
await t.test("should create a bot with minimal config", () => {
const config = createMockBotConfig();
const bot = createBot(config);
assert.ok(bot);
assert.ok(bot.getClient);
assert.strictEqual(typeof bot.start, "function");
assert.strictEqual(typeof bot.shutdown, "function");
});
await t.test("should handle basic bot configuration", () => {
const config = createMockBotConfig();
const bot = createBot(config);
// Test that bot was created successfully
assert.ok(bot);
const client = bot.getClient();
assert.ok(client);
assert.ok(client.commands);
});
await t.test("should validate required config fields", () => {
// Test that createBot throws error for missing token
assert.throws(() => {
createBot({ clientId: "test", guildId: "test" } as any);
}, /token/);
// Test that createBot throws error for missing clientId
assert.throws(() => {
createBot({ token: "test", guildId: "test" } as any);
}, /clientId/);
});
});