Files
CC-Switch/tests/config/opencodeProviderPresets.test.ts
Jason b972f0a3bd feat(presets): upgrade default models to Opus 5, GPT-5.6 Sol and Gemini 3.6 Flash
Bump the default model IDs across every preset file and the downstream
defaults that mirror them:

- claude-opus-4-8 / anthropic/claude-opus-4.8 / global.anthropic.claude-opus-4-8
  -> claude-opus-5, covering all three naming forms
- gpt-5.5 and the bare gpt-5.6 -> gpt-5.6-sol
- gemini-3.5-flash -> gemini-3.6-flash

Add gemini-3.6-flash to the built-in pricing seed (1.50 in / 7.50 out /
0.15 cache read per million). The seed runs INSERT OR IGNORE on every
startup, so existing databases pick the row up without overriding prices
the user edited by hand.

Advance the Claude Desktop opus route ID in step with the frontend SSOT:
CURRENT_OPUS_ROUTE_ID becomes claude-opus-5 and claude-opus-4-8 takes over
the LEGACY slot, so route IDs stored in existing user configs still resolve
through is_compatible_opus_route_alias.

Also sync omo.ts recommendations, form placeholders, the SudoCode partner
blurb and all four locales, plus the preset assertions that pin these IDs.
2026-07-26 19:08:33 +08:00

96 lines
3.5 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
opencodeProviderPresets,
opencodeNpmPackages,
OPENCODE_PRESET_MODEL_VARIANTS,
} from "@/config/opencodeProviderPresets";
describe("AWS Bedrock OpenCode Provider Presets", () => {
it("should include @ai-sdk/amazon-bedrock in npm packages", () => {
const bedrockPkg = opencodeNpmPackages.find(
(p) => p.value === "@ai-sdk/amazon-bedrock",
);
expect(bedrockPkg).toBeDefined();
expect(bedrockPkg!.label).toBe("Amazon Bedrock");
});
it("should include Bedrock model variants", () => {
const variants = OPENCODE_PRESET_MODEL_VARIANTS["@ai-sdk/amazon-bedrock"];
expect(variants).toBeDefined();
expect(variants.length).toBeGreaterThan(0);
const opusModel = variants.find((v) =>
v.id.includes("anthropic.claude-opus-5"),
);
expect(opusModel).toBeDefined();
});
const bedrockPreset = opencodeProviderPresets.find(
(p) => p.name === "AWS Bedrock",
);
it("should include AWS Bedrock preset", () => {
expect(bedrockPreset).toBeDefined();
});
it("Bedrock preset should use @ai-sdk/amazon-bedrock npm package", () => {
expect(bedrockPreset!.settingsConfig.npm).toBe("@ai-sdk/amazon-bedrock");
});
it("Bedrock preset should have region in options", () => {
expect(bedrockPreset!.settingsConfig.options).toHaveProperty("region");
});
it("Bedrock preset should have cloud_provider category", () => {
expect(bedrockPreset!.category).toBe("cloud_provider");
});
it("Bedrock preset should have template values for AWS credentials", () => {
expect(bedrockPreset!.templateValues).toBeDefined();
expect(bedrockPreset!.templateValues!.region).toBeDefined();
expect(bedrockPreset!.templateValues!.region.editorValue).toBe("us-west-2");
expect(bedrockPreset!.templateValues!.accessKeyId).toBeDefined();
expect(bedrockPreset!.templateValues!.secretAccessKey).toBeDefined();
});
it("Bedrock preset should include Claude models", () => {
const models = bedrockPreset!.settingsConfig.models;
expect(models).toBeDefined();
const modelIds = Object.keys(models!);
expect(modelIds.some((id) => id.includes("anthropic.claude"))).toBe(true);
});
it("Kimi For Coding preset should use Anthropic with the coding endpoint", () => {
const kimiForCodingPreset = opencodeProviderPresets.find(
(p) => p.name === "Kimi For Coding",
);
expect(kimiForCodingPreset).toBeDefined();
expect(kimiForCodingPreset!.settingsConfig.npm).toBe("@ai-sdk/anthropic");
expect(kimiForCodingPreset!.settingsConfig.options?.baseURL).toBe(
"https://api.kimi.com/coding/v1",
);
expect(kimiForCodingPreset!.templateValues?.baseURL.defaultValue).toBe(
"https://api.kimi.com/coding/v1",
);
});
it("Xiaomi MiMo presets should include official OpenCode model metadata", () => {
const presets = ["Xiaomi MiMo", "Xiaomi MiMo Token Plan (China)"].map(
(name) => opencodeProviderPresets.find((preset) => preset.name === name),
);
for (const preset of presets) {
expect(preset).toBeDefined();
expect(preset!.settingsConfig.models["mimo-v2.5-pro"]).toMatchObject({
limit: { context: 1048576, output: 131072 },
modalities: { input: ["text"], output: ["text"] },
});
expect(preset!.settingsConfig.models["mimo-v2.5"]).toMatchObject({
limit: { context: 1048576, output: 131072 },
modalities: { input: ["text", "image"], output: ["text"] },
});
}
});
});