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]

617 B
Raw Blame
import { keyActivityLabel } from "./keyActivityLabel";

describe("keyActivityLabel", () => {
  it("prefers key_alias", () => {
    expect(keyActivityLabel({ key_alias: "batch-worker", user_email: "[email protected]" })).toBe("batch-worker");
  });

  it("falls back to user_email when alias is missing", () => {
    expect(keyActivityLabel({ key_alias: null, user_email: "[email protected]" })).toBe("[email protected]");
  });

  it("uses the fallback when both alias and email are missing", () => {
    expect(keyActivityLabel({ key_alias: null, user_email: null }, "key-hash-abc")).toBe("key-hash-abc");
  });
});