Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

735 B
Raw Blame
import { describe, expect, it } from "vitest";
import { normalizeMoyaiUrl } from "./moyaiConnect";

describe("normalizeMoyaiUrl", () => {
  it("trims whitespace and strips trailing slashes", () => {
    expect(normalizeMoyaiUrl("  https://moyai.example.com/  ")).toBe("https://moyai.example.com");
  });

  it("keeps paths and ports", () => {
    expect(normalizeMoyaiUrl("http://localhost:8080/moyai/")).toBe("http://localhost:8080/moyai");
  });

  it.each([
    "javascript:alert(1)",
    "ftp://moyai.example.com",
    "not a url",
    "https://",
    "https://user:[email protected]",
    "https://[email protected]",
    "   ",
  ])("rejects %s", (input) => {
    expect(normalizeMoyaiUrl(input)).toBeNull();
  });
});