feat: Add testing framework and initial test cases for various tools and database operations

This commit is contained in:
ethan.chen
2026-01-07 10:05:04 +08:00
parent 372b52b214
commit 47ecc40186
23 changed files with 1781 additions and 40 deletions

View File

@@ -0,0 +1,61 @@
/**
* Documentation tools tests
*/
import { describe, test, expect, beforeEach } from "bun:test";
import { registerDocsTools } from "../../../../src/tools/programming/docs.js";
import { callTool } from "../../../helpers/tool-helper.js";
describe("Documentation Tools", () => {
beforeEach(() => {
registerDocsTools();
});
test("should get TypeScript documentation", async () => {
const result = await callTool("docs_typescript", {});
expect(result.content[0].text).toContain("TypeScript Documentation");
expect(result.content[0].text).toContain("typescriptlang.org");
});
test("should get TypeScript documentation with topic", async () => {
const result = await callTool("docs_typescript", {
topic: "generics",
});
expect(result.content[0].text).toContain("TypeScript Documentation");
expect(result.content[0].text).toContain("generics");
});
test("should get Vue3 documentation", async () => {
const result = await callTool("docs_vue3", {});
expect(result.content[0].text).toContain("Vue 3 Documentation");
expect(result.content[0].text).toContain("vuejs.org");
});
test("should get Vue3 documentation with topic", async () => {
const result = await callTool("docs_vue3", {
topic: "composition",
});
expect(result.content[0].text).toContain("Vue 3 Documentation");
expect(result.content[0].text).toContain("composition");
});
test("should get Bun documentation", async () => {
const result = await callTool("docs_bun", {});
expect(result.content[0].text).toContain("Bun Documentation");
expect(result.content[0].text).toContain("bun.sh");
});
test("should get Bun documentation with topic", async () => {
const result = await callTool("docs_bun", {
topic: "runtime",
});
expect(result.content[0].text).toContain("Bun Documentation");
expect(result.content[0].text).toContain("runtime");
});
});