Files
Agent Zero cd465e0564 feat: add MCP server with resources, tools, auth, and Traefik routing
- 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
2026-07-12 15:58:22 +02:00

102 lines
3.2 KiB
TypeScript

import { describe, it, expect } from "vitest";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
describe("Cart Store", () => {
const storePath = resolve(__dirname, "../../stores/cart.ts");
const content = readFileSync(storePath, "utf-8");
it("should define useCartStore with defineStore", () => {
expect(content).toContain("defineStore");
expect(content).toContain("useCartStore");
});
it("should have CartItem interface with required fields", () => {
expect(content).toContain("equipment_id");
expect(content).toContain("name");
expect(content).toContain("quantity");
expect(content).toContain("rental_price");
expect(content).toContain("image_url");
});
it("should have totalCount getter", () => {
expect(content).toContain("totalCount");
expect(content).toContain("reduce");
});
it("should have isEmpty getter", () => {
expect(content).toContain("isEmpty");
});
it("should have hasItems getter", () => {
expect(content).toContain("hasItems");
});
it("should have apiItems getter for rental request payload", () => {
expect(content).toContain("apiItems");
expect(content).toContain("equipment_id");
expect(content).toContain("quantity");
});
it("should have addItem action", () => {
expect(content).toContain("addItem");
expect(content).toContain("existing");
expect(content).toContain("quantity += 1");
});
it("should have addItemByFields action", () => {
expect(content).toContain("addItemByFields");
});
it("should have removeItem action", () => {
expect(content).toContain("removeItem");
expect(content).toContain("splice");
});
it("should have updateQuantity action", () => {
expect(content).toContain("updateQuantity");
expect(content).toContain("quantity <= 0");
});
it("should have incrementQuantity action", () => {
expect(content).toContain("incrementQuantity");
});
it("should have decrementQuantity action", () => {
expect(content).toContain("decrementQuantity");
});
it("should have clearCart action", () => {
expect(content).toContain("clearCart");
expect(content).toContain("items = []");
});
it("should have RentalRequestPayload interface", () => {
expect(content).toContain("RentalRequestPayload");
expect(content).toContain("event_name");
expect(content).toContain("date_start");
expect(content).toContain("date_end");
expect(content).toContain("location");
expect(content).toContain("person_count");
expect(content).toContain("contact_name");
expect(content).toContain("contact_email");
expect(content).toContain("contact_phone");
expect(content).toContain("contact_street");
expect(content).toContain("contact_postalcode");
expect(content).toContain("contact_city");
expect(content).toContain("message");
expect(content).toContain("items");
});
it("should have RentalRequestResponse interface", () => {
expect(content).toContain("RentalRequestResponse");
expect(content).toContain("reference_number");
expect(content).toContain("status");
});
it("should use TypeScript", () => {
expect(content).toContain("import type");
expect(content).toContain("export interface");
});
});