mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 23:00:43 +00:00
test: simplify provider thinking level scans
This commit is contained in:
@@ -23,6 +23,16 @@ function createModel(id: string, name: string): ModelDefinitionConfig {
|
||||
};
|
||||
}
|
||||
|
||||
function collectLegacyExtendedLevelIds(levels: readonly { id: string }[] | undefined): string[] {
|
||||
const ids: string[] = [];
|
||||
for (const level of levels ?? []) {
|
||||
if (level.id === "xhigh" || level.id === "max") {
|
||||
ids.push(level.id);
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
describe("anthropic provider policy public artifact", () => {
|
||||
it("normalizes Anthropic provider config", () => {
|
||||
expect(
|
||||
@@ -117,9 +127,7 @@ describe("anthropic provider policy public artifact", () => {
|
||||
if (!profile) {
|
||||
throw new Error("Expected Anthropic policy profile");
|
||||
}
|
||||
expect(
|
||||
profile.levels.map((level) => level.id).filter((id) => id === "xhigh" || id === "max"),
|
||||
).toEqual([]);
|
||||
expect(collectLegacyExtendedLevelIds(profile.levels)).toEqual([]);
|
||||
});
|
||||
|
||||
it("does not expose Anthropic thinking profiles for unrelated providers", () => {
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveThinkingProfile } from "./provider-policy-api.js";
|
||||
|
||||
function collectLegacyExtendedLevelIds(levels: readonly { id: string }[] | undefined): string[] {
|
||||
const ids: string[] = [];
|
||||
for (const level of levels ?? []) {
|
||||
if (level.id === "xhigh" || level.id === "max") {
|
||||
ids.push(level.id);
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
describe("opencode provider policy public artifact", () => {
|
||||
it("exposes Claude Opus 4.7 thinking levels without loading the full provider plugin", () => {
|
||||
expect(
|
||||
@@ -24,8 +34,6 @@ describe("opencode provider policy public artifact", () => {
|
||||
levels: expect.arrayContaining([{ id: "adaptive" }]),
|
||||
defaultLevel: "adaptive",
|
||||
});
|
||||
expect(
|
||||
profile.levels.map((level) => level.id).filter((id) => id === "xhigh" || id === "max"),
|
||||
).toEqual([]);
|
||||
expect(collectLegacyExtendedLevelIds(profile.levels)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,6 +5,16 @@ import {
|
||||
import { describe, expect, it } from "vitest";
|
||||
import plugin from "./index.js";
|
||||
|
||||
function collectLegacyExtendedLevelIds(levels: readonly { id: string }[] | undefined): string[] {
|
||||
const ids: string[] = [];
|
||||
for (const level of levels ?? []) {
|
||||
if (level.id === "xhigh" || level.id === "max") {
|
||||
ids.push(level.id);
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
describe("vercel ai gateway thinking profile", () => {
|
||||
async function getProvider() {
|
||||
const { providers } = await registerProviderPlugin({
|
||||
@@ -49,9 +59,7 @@ describe("vercel ai gateway thinking profile", () => {
|
||||
levels: expect.arrayContaining([{ id: "adaptive" }]),
|
||||
defaultLevel: "adaptive",
|
||||
});
|
||||
expect(
|
||||
profile?.levels.map((level) => level.id).filter((id) => id === "xhigh" || id === "max"),
|
||||
).toEqual([]);
|
||||
expect(collectLegacyExtendedLevelIds(profile?.levels)).toEqual([]);
|
||||
});
|
||||
|
||||
it("falls through for unsupported OpenAI or untrusted namespaced refs", async () => {
|
||||
|
||||
Reference in New Issue
Block a user