feat: Add testing framework and initial test cases for various tools and database operations
This commit is contained in:
61
tests/unit/tools/programming/docs.test.ts
Normal file
61
tests/unit/tools/programming/docs.test.ts
Normal 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");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user