Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

1.6 KB
Raw Blame
import { describe, it } from "node:test";
import assert from "node:assert/strict";

// Test plugin API route structure and type contracts.
// Full HTTP integration tests require the Next.js test harness.

describe("plugin API routes", () => {
  describe("route modules exist", () => {
    it("main plugins route exports GET and POST", async () => {
      const mod = await import("../../src/app/api/plugins/route.ts");
      assert.equal(typeof mod.GET, "function");
      assert.equal(typeof mod.POST, "function");
    });

    it("[name] route exports GET and DELETE", async () => {
      const mod = await import("../../src/app/api/plugins/[name]/route.ts");
      assert.equal(typeof mod.GET, "function");
      assert.equal(typeof mod.DELETE, "function");
    });

    it("activate route exports POST", async () => {
      const mod = await import("../../src/app/api/plugins/[name]/activate/route.ts");
      assert.equal(typeof mod.POST, "function");
    });

    it("deactivate route exports POST", async () => {
      const mod = await import("../../src/app/api/plugins/[name]/deactivate/route.ts");
      assert.equal(typeof mod.POST, "function");
    });

    it("config route exports GET and PUT", async () => {
      const mod = await import("../../src/app/api/plugins/[name]/config/route.ts");
      assert.equal(typeof mod.GET, "function");
      assert.equal(typeof mod.PUT, "function");
    });

    it("scan route exports POST", async () => {
      const mod = await import("../../src/app/api/plugins/scan/route.ts");
      assert.equal(typeof mod.POST, "function");
    });
  });
});