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.2 KB
Raw Blame
import test from "node:test";
import assert from "node:assert/strict";
import { resolveHealthPath } from "../../scripts/dev/healthcheck.mjs";

test("resolveHealthPath keeps the default lightweight /healthz route at the domain root (#10311)", () => {
  assert.equal(resolveHealthPath(""), "/healthz");
  assert.equal(resolveHealthPath(undefined), "/healthz");
});

test("resolveHealthPath prefixes the health route with OMNIROUTE_BASE_PATH", () => {
  assert.equal(resolveHealthPath("/omniroute/"), "/omniroute/healthz");
  assert.equal(resolveHealthPath("/omniroute"), "/omniroute/healthz");
});

test("resolveHealthPath honors an explicit OMNIROUTE_HEALTHCHECK_PATH override", () => {
  assert.equal(resolveHealthPath(undefined, "/api/monitoring/health"), "/api/monitoring/health");
  assert.equal(
    resolveHealthPath("/omniroute", "/api/monitoring/health"),
    "/omniroute/api/monitoring/health"
  );
});

test("resolveHealthPath ignores an invalid/empty OMNIROUTE_HEALTHCHECK_PATH and falls back to /healthz", () => {
  assert.equal(resolveHealthPath("", "  "), "/healthz");
  assert.equal(resolveHealthPath("", "/../etc/passwd"), "/healthz");
  assert.equal(resolveHealthPath("", "/health?utm=1"), "/healthz");
});