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
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
/**
* Shared API route collector — locks path normalization used by openapi + docs gates.
*/
import test from "node:test";
import assert from "node:assert/strict";
import path from "node:path";
import {
collectApiRouteFiles,
collectApiRouteUrlPaths,
toApiUrlPath,
} from "../../scripts/check/lib/apiRoutes.mjs";
test("toApiUrlPath maps [id] and [...slug] to OpenAPI-style braces", () => {
const apiRoot = path.join("C:", "repo", "src", "app", "api");
assert.equal(
toApiUrlPath(path.join(apiRoot, "providers", "[id]", "models"), apiRoot).replace(/\\/g, "/"),
"/api/providers/{id}/models"
);
assert.equal(
toApiUrlPath(path.join(apiRoot, "files", "[...path]"), apiRoot).replace(/\\/g, "/"),
"/api/files/{path}"
);
});
test("live repo has route files and matching URL paths", () => {
const files = collectApiRouteFiles();
const urls = collectApiRouteUrlPaths();
assert.ok(files.size > 50, `expected many route files, got ${files.size}`);
assert.ok(urls.length > 50, `expected many url paths, got ${urls.length}`);
assert.equal(files.size, urls.length, "each route file should yield one URL path");
assert.ok([...files].every((f) => f.startsWith("src/app/api/") && /route\.tsx?$/.test(f)));
assert.ok(urls.every((u) => u.startsWith("/api")));
});