codingPlanEnterpriseTiers.test.ts 978 B

12345678910111213141516171819202122232425
  1. import { describe, expect, it } from "vitest";
  2. import { formatEnterpriseTier } from "@/settings/model-provider-section/codingPlanEnterpriseTiers.js";
  3. import zhCN from "@/i18n/locales/zh-CN.js";
  4. // 原生购买面板退役后,企业档位仍用于设置页;将对应活代码的语言契约保留在此。
  5. describe("enterprise tier labels", () => {
  6. it.each([
  7. ["LITE", "基础版"],
  8. ["PRO", "标准版"],
  9. ["MAX", "高级版"],
  10. ])("localizes %s using the configured messages", (tier, label) => {
  11. expect(
  12. formatEnterpriseTier(tier, {
  13. locale: "zh-CN",
  14. formatMessage: (id, fallback) => zhCN[id as keyof typeof zhCN] ?? fallback,
  15. }),
  16. ).toBe(label);
  17. });
  18. it("preserves the English and unknown-tier fallback", () => {
  19. expect(formatEnterpriseTier("PRO", "en-US")).toBe("Pro");
  20. expect(formatEnterpriseTier("MAX", "en-US")).toBe("Max");
  21. expect(formatEnterpriseTier("TEAM_PLUS", "zh-CN")).toBe("Team_plus");
  22. });
  23. });