| 1 | import assert from "node:assert/strict"; |
| 2 | import React from "react"; |
| 3 | import { renderToStaticMarkup } from "react-dom/server"; |
| 4 | import { AddProviderPanel } from "../components/SettingsPanel"; |
| 5 | import { LocaleProvider } from "../lib/i18n"; |
| 6 | import type { ProviderView } from "../lib/types"; |
| 7 | import { mockProviderTemplate } from "../lib/mockProviderTemplates"; |
| 8 | |
| 9 | const legacy: ProviderView = { |
| 10 | ...mockProviderTemplate({ |
| 11 | name: "deepseek", kind: "openai", |
| 12 | baseUrl: "https://api.deepseek.com", apiKeyEnv: "DEEPSEEK_API_KEY", |
| 13 | models: ["deepseek-v4-flash", "custom-ID"], default: "custom-ID", |
| 14 | }), |
| 15 | builtIn: true, |
| 16 | }; |
| 17 | for (const existing of [[], [legacy]]) { |
| 18 | const html = renderToStaticMarkup(<LocaleProvider><AddProviderPanel |
| 19 | mode="official" kinds={["openai", "anthropic", "responses"]} |
| 20 | officialProviders={existing} providerPresets={[]} busy={false} |
| 21 | onMode={() => {}} onCancel={() => {}} onAddOfficial={async () => {}} |
| 22 | onAddPreset={async () => {}} onViewPresetConflict={() => {}} |
| 23 | onResetPreset={async () => {}} onAddCustom={() => {}} |
| 24 | /></LocaleProvider>); |
| 25 | assert.match(html, /deepseek-flash, deepseek-v4-pro/); |
| 26 | assert.doesNotMatch(html, /deepseek-v4-flash|custom-ID/); |
| 27 | } |
| 28 | assert.deepEqual(legacy.models, ["deepseek-v4-flash", "custom-ID"]); |
| 29 | assert.equal(legacy.default, "custom-ID"); |
| 30 | console.log("PASS official provider catalog: current defaults with legacy connections preserved"); |
| 31 |