Skip to main content
Glama
utilities.test.ts1.58 kB
import { describe, it, expect } from "vitest"; import { gitHelperHandler, packageJsonHandler, dockerfileHandler, envTemplateHandler, } from "./utilities.js"; describe("Utility Tools", () => { describe("gitHelperHandler", () => { it("should generate undo-commit", () => { const result = gitHelperHandler({ scenario: "undo-commit" }); expect(result.content[0].text).toContain("git reset --soft"); }); it("should handle unkown scenario", () => { const result = gitHelperHandler({ scenario: "unknown" } as any); expect(result.content[0].text).toContain("Unknown scenario"); }); }); describe("packageJsonHandler", () => { it("should generate node-api package.json", () => { const result = packageJsonHandler({ name: "test", type: "node-api" }); expect(result.content[0].text).toContain('"name": "test"'); expect(result.content[0].text).toContain("express"); }); }); describe("dockerfileHandler", () => { it("should generate node dockerfile", () => { const result = dockerfileHandler({ type: "node", port: 8080 }); expect(result.content[0].text).toContain("FROM node:20-alpine"); expect(result.content[0].text).toContain("EXPOSE 8080"); }); }); describe("envTemplateHandler", () => { it("should generate env template", () => { const result = envTemplateHandler({ type: "auth", database: "postgres" }); expect(result.content[0].text).toContain("DATABASE_URL=postgresql"); expect(result.content[0].text).toContain("JWT_SECRET"); }); }); });

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/millsydotdev/Code-MCP'

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