cd465e0564
- Add backend/app/mcp_server.py with FastMCP server (hms-cms) - Resources: design-rules, page-structure, sync-status - Tools: trigger_sync, get_sync_log, set_rentman_token, read_file, write_file, create_page, deploy, git_commit, git_status - Bearer token auth via MCP_AUTH_TOKEN env var - Mount MCP at /mcp with streamable HTTP transport - Integrate session manager in FastAPI lifespan - Add Traefik labels for external /mcp route on hms.media-on.de - Add git, docker.io, curl to backend Dockerfile - Mount repo root + docker socket in backend container - Add mcp>=1.0.0 to requirements.txt
85 lines
2.7 KiB
TypeScript
85 lines
2.7 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { readFileSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
|
|
describe("useApi composable", () => {
|
|
const path = resolve(__dirname, "../../composables/useApi.ts");
|
|
const content = readFileSync(path, "utf-8");
|
|
|
|
it("should export useApi function", () => {
|
|
expect(content).toContain("export function useApi");
|
|
});
|
|
|
|
it("should use useRuntimeConfig for apiBase", () => {
|
|
expect(content).toContain("useRuntimeConfig");
|
|
expect(content).toContain("apiBase");
|
|
});
|
|
|
|
it("should create $fetch client with baseURL", () => {
|
|
expect(content).toContain("$fetch.create");
|
|
expect(content).toContain("baseURL");
|
|
});
|
|
|
|
it("should export get, post, put, del methods", () => {
|
|
expect(content).toContain("async function get");
|
|
expect(content).toContain("async function post");
|
|
expect(content).toContain("async function put");
|
|
expect(content).toContain("async function del");
|
|
});
|
|
});
|
|
|
|
describe("useEquipment composable", () => {
|
|
const path = resolve(__dirname, "../../composables/useEquipment.ts");
|
|
const content = readFileSync(path, "utf-8");
|
|
|
|
it("should export EquipmentItem interface", () => {
|
|
expect(content).toContain("export interface EquipmentItem");
|
|
});
|
|
|
|
it("should export EquipmentDetail interface", () => {
|
|
expect(content).toContain("export interface EquipmentDetail");
|
|
});
|
|
|
|
it("should export PaginatedEquipment interface", () => {
|
|
expect(content).toContain("export interface PaginatedEquipment");
|
|
});
|
|
|
|
it("should export SortOption type", () => {
|
|
expect(content).toContain("export type SortOption");
|
|
});
|
|
|
|
it("should use useApi internally", () => {
|
|
expect(content).toContain("useApi");
|
|
});
|
|
|
|
it("should have list method with search, category, sort, page params", () => {
|
|
expect(content).toContain("async function list");
|
|
expect(content).toContain("search");
|
|
expect(content).toContain("category");
|
|
expect(content).toContain("sort");
|
|
expect(content).toContain("page");
|
|
});
|
|
|
|
it("should call /api/equipment for list", () => {
|
|
expect(content).toContain("/api/equipment");
|
|
expect(content).toContain("/api/equipment/categories");
|
|
expect(content).toContain("/api/equipment/${id}");
|
|
});
|
|
|
|
it("should have detail method", () => {
|
|
expect(content).toContain("async function detail");
|
|
});
|
|
|
|
it("should have categories method", () => {
|
|
expect(content).toContain("async function categories");
|
|
expect(content).toContain("/api/equipment/categories");
|
|
});
|
|
|
|
it("should return list, detail, categories from composable", () => {
|
|
expect(content).toContain("return");
|
|
expect(content).toContain("list");
|
|
expect(content).toContain("detail");
|
|
expect(content).toContain("categories");
|
|
});
|
|
});
|