Skip to main content
Glama
index.test.ts1.27 kB
import { describe, test, expect } from "vitest"; import { SearchLibraryCommand } from "./index"; import { newHttpClient } from "../../utils/test-utils"; import { Context7 } from "../../client"; const httpClient = newHttpClient(); describe("SearchLibraryCommand", () => { test("should search for a library", async () => { const command = new SearchLibraryCommand("react"); const result = await command.exec(httpClient); expect(result).toBeDefined(); expect(result.results).toBeDefined(); expect(Array.isArray(result.results)).toBe(true); expect(result.results.length).toBeGreaterThan(0); expect(result.metadata).toBeDefined(); expect(typeof result.metadata.authentication).toBe("string"); }); test("should search for a library using client", async () => { const client = new Context7({ apiKey: process.env.CONTEXT7_API_KEY || process.env.API_KEY!, }); const result = await client.searchLibrary("react"); expect(result).toBeDefined(); expect(result.results).toBeDefined(); expect(Array.isArray(result.results)).toBe(true); expect(result.results.length).toBeGreaterThan(0); expect(result.metadata).toBeDefined(); expect(typeof result.metadata.authentication).toBe("string"); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/upstash/context7-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server