mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-25 13:45:03 +08:00
39ec987396
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
80 lines
3.0 KiB
TypeScript
80 lines
3.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { providerPresets } from "@/config/claudeProviderPresets";
|
|
|
|
describe("AWS Bedrock Provider Presets", () => {
|
|
const bedrockAksk = providerPresets.find(
|
|
(p) => p.name === "AWS Bedrock (AKSK)",
|
|
);
|
|
|
|
it("should include AWS Bedrock (AKSK) preset", () => {
|
|
expect(bedrockAksk).toBeDefined();
|
|
});
|
|
|
|
it("AKSK preset should have required AWS env variables", () => {
|
|
const env = (bedrockAksk!.settingsConfig as any).env;
|
|
expect(env).toHaveProperty("AWS_ACCESS_KEY_ID");
|
|
expect(env).toHaveProperty("AWS_SECRET_ACCESS_KEY");
|
|
expect(env).toHaveProperty("AWS_REGION");
|
|
expect(env).toHaveProperty("CLAUDE_CODE_USE_BEDROCK", "1");
|
|
});
|
|
|
|
it("AKSK preset should have template values for AWS credentials", () => {
|
|
expect(bedrockAksk!.templateValues).toBeDefined();
|
|
expect(bedrockAksk!.templateValues!.AWS_ACCESS_KEY_ID).toBeDefined();
|
|
expect(bedrockAksk!.templateValues!.AWS_SECRET_ACCESS_KEY).toBeDefined();
|
|
expect(bedrockAksk!.templateValues!.AWS_REGION).toBeDefined();
|
|
expect(bedrockAksk!.templateValues!.AWS_REGION.editorValue).toBe(
|
|
"us-west-2",
|
|
);
|
|
});
|
|
|
|
it("AKSK preset should have correct base URL template", () => {
|
|
const env = (bedrockAksk!.settingsConfig as any).env;
|
|
expect(env.ANTHROPIC_BASE_URL).toContain("bedrock-runtime");
|
|
expect(env.ANTHROPIC_BASE_URL).toContain("${AWS_REGION}");
|
|
});
|
|
|
|
it("AKSK preset should have cloud_provider category", () => {
|
|
expect(bedrockAksk!.category).toBe("cloud_provider");
|
|
});
|
|
|
|
it("AKSK preset should have Bedrock model as default", () => {
|
|
const env = (bedrockAksk!.settingsConfig as any).env;
|
|
expect(env.ANTHROPIC_MODEL).toContain("anthropic.claude");
|
|
});
|
|
|
|
const bedrockApiKey = providerPresets.find(
|
|
(p) => p.name === "AWS Bedrock (API Key)",
|
|
);
|
|
|
|
it("should include AWS Bedrock (API Key) preset", () => {
|
|
expect(bedrockApiKey).toBeDefined();
|
|
});
|
|
|
|
it("API Key preset should have apiKey template and AWS env variables", () => {
|
|
const config = bedrockApiKey!.settingsConfig as any;
|
|
expect(config).toHaveProperty("apiKey", "${BEDROCK_API_KEY}");
|
|
expect(config.env).toHaveProperty("AWS_REGION");
|
|
expect(config.env).toHaveProperty("CLAUDE_CODE_USE_BEDROCK", "1");
|
|
});
|
|
|
|
it("API Key preset should NOT have AKSK env variables", () => {
|
|
const env = (bedrockApiKey!.settingsConfig as any).env;
|
|
expect(env).not.toHaveProperty("AWS_ACCESS_KEY_ID");
|
|
expect(env).not.toHaveProperty("AWS_SECRET_ACCESS_KEY");
|
|
});
|
|
|
|
it("API Key preset should have template values for API key and region", () => {
|
|
expect(bedrockApiKey!.templateValues).toBeDefined();
|
|
expect(bedrockApiKey!.templateValues!.BEDROCK_API_KEY).toBeDefined();
|
|
expect(bedrockApiKey!.templateValues!.AWS_REGION).toBeDefined();
|
|
expect(bedrockApiKey!.templateValues!.AWS_REGION.editorValue).toBe(
|
|
"us-west-2",
|
|
);
|
|
});
|
|
|
|
it("API Key preset should have cloud_provider category", () => {
|
|
expect(bedrockApiKey!.category).toBe("cloud_provider");
|
|
});
|
|
});
|