|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | + |
| 3 | +import REGISTRY from "../../open-sse/providers/registry/index.js"; |
| 4 | +import { PROVIDERS, PROVIDER_MODELS } from "../../open-sse/providers/index.js"; |
| 5 | + |
| 6 | +describe("Alibaba Token Plan provider", () => { |
| 7 | + const entry = REGISTRY.find((e) => e.id === "alitp-intl"); |
| 8 | + |
| 9 | + it("is registered as an OpenAI-compatible apikey provider", () => { |
| 10 | + expect(entry).toBeDefined(); |
| 11 | + expect(entry.category).toBe("apikey"); |
| 12 | + expect(PROVIDERS["alitp-intl"]).toBeDefined(); |
| 13 | + expect(PROVIDERS["alitp-intl"].format).toBe("openai"); |
| 14 | + }); |
| 15 | + |
| 16 | + it("targets the Singapore Token Plan host in compatible mode", () => { |
| 17 | + // eu-central-1 answers IllegalEndpoint; the plan is Singapore-only. |
| 18 | + expect(PROVIDERS["alitp-intl"].baseUrl).toBe( |
| 19 | + "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions", |
| 20 | + ); |
| 21 | + }); |
| 22 | + |
| 23 | + it("does not collide with the other three Alibaba key types", () => { |
| 24 | + const hosts = ["alicode", "alicode-intl", "alims-intl", "alitp-intl"] |
| 25 | + .map((id) => new URL(PROVIDERS[id].baseUrl).host); |
| 26 | + expect(new Set(hosts).size).toBe(hosts.length); |
| 27 | + }); |
| 28 | + |
| 29 | + it("exposes the models the plan actually serves", () => { |
| 30 | + const ids = (PROVIDER_MODELS["alitp-intl"] || []).map((m) => m.id); |
| 31 | + expect(ids).toEqual(expect.arrayContaining([ |
| 32 | + "qwen3.8-max-preview", |
| 33 | + "qwen3.7-max", |
| 34 | + "qwen3.7-plus", |
| 35 | + "qwen3.6-flash", |
| 36 | + "glm-5.2", |
| 37 | + "deepseek-v4-pro", |
| 38 | + ])); |
| 39 | + }); |
| 40 | + |
| 41 | + it("keeps every registry id unique after adding the provider", () => { |
| 42 | + const ids = REGISTRY.map((e) => e.id); |
| 43 | + expect(new Set(ids).size).toBe(ids.length); |
| 44 | + }); |
| 45 | +}); |
0 commit comments