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
import { describe, it } from "node:test";
import assert from "node:assert/strict";
import { comboRuntimeConfigSchema, updateComboSchema } from "@/shared/validation/schemas/combo";
describe("comboRuntimeConfigSchema.modelSort", () => {
it("accepts a valid modelSort method", () => {
const parsed = comboRuntimeConfigSchema.parse({ modelSort: { method: "provider" } });
assert.deepEqual(parsed.modelSort, { method: "provider" });
});
it("rejects an invalid method", () => {
assert.throws(() => comboRuntimeConfigSchema.parse({ modelSort: { method: "bogus" } }));
});
it("allows extra keys on the modelSort sub-object (passthrough)", () => {
const parsed = comboRuntimeConfigSchema.parse({ modelSort: { method: "name", future: 1 } });
assert.equal(parsed.modelSort?.method, "name");
});
it("is optional", () => {
const parsed = comboRuntimeConfigSchema.parse({});
assert.equal(parsed.modelSort, undefined);
});
});
describe("modelSort persistence", () => {
it("round-trips through updateComboSchema (models + config)", () => {
const parsed = updateComboSchema.parse({
models: [{ id: "m1", kind: "model", model: "openai/gpt", providerId: "openai", weight: 0 }],
config: { modelSort: { method: "score" } },
});
assert.equal(parsed.config?.modelSort?.method, "score");
});
it("passes through comboRuntimeConfigSchema", () => {
const parsed = comboRuntimeConfigSchema.parse({ modelSort: { method: "provider" } });
assert.equal(parsed.modelSort?.method, "provider");
});
});