Skip to main content
Glama
kibela
by kibela
env.test.ts1.76 kB
import { describe, it, expect, vi, beforeEach, afterAll } from "vitest"; import { z } from "zod"; describe("env variables schema", () => { const originalEnv = { ...process.env }; beforeEach(() => { vi.resetModules(); process.env = { ...originalEnv }; }); afterAll(() => { process.env = originalEnv; }); it("should define environment variable schema for Kibela", () => { const schema = z.object({ KIBELA_ORIGIN: z.string().url(), KIBELA_ACCESS_TOKEN: z.string(), }); const validEnv = { KIBELA_ORIGIN: "https://example.kibe.la", KIBELA_ACCESS_TOKEN: "test-token", }; const result = schema.safeParse(validEnv); expect(result.success).toBe(true); }); it("should validate the KIBELA_ORIGIN as a valid URL", () => { const schema = z.object({ KIBELA_ORIGIN: z.string().url(), KIBELA_ACCESS_TOKEN: z.string(), }); const invalidEnv = { KIBELA_ORIGIN: "not-a-url", KIBELA_ACCESS_TOKEN: "test-token", }; const result = schema.safeParse(invalidEnv); expect(result.success).toBe(false); if (!result.success) { const error = result.error.format(); expect(error.KIBELA_ORIGIN?._errors).toBeDefined(); } }); it("should require both KIBELA_ORIGIN and KIBELA_ACCESS_TOKEN", () => { const schema = z.object({ KIBELA_ORIGIN: z.string().url(), KIBELA_ACCESS_TOKEN: z.string(), }); const partialEnv = { KIBELA_ORIGIN: "https://example.kibe.la", }; const result = schema.safeParse(partialEnv); expect(result.success).toBe(false); if (!result.success) { const error = result.error.format(); expect(error.KIBELA_ACCESS_TOKEN?._errors).toBeDefined(); } }); });

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/kibela/kibela-mcp-server'

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