mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-24 01:01:14 +00:00
* chore(models): migrate active GPT-5.5 references * test(workboard): expect GPT-5.6 Sol default * chore: keep release notes in PR body * test(models): align picker fixtures with Sol default * test: update PDF default model expectation * test(qa): migrate thinking smoke to Luna * test(gateway): align mock catalog with Sol default * ci: retrigger exact-head PR checks * test(gateway): document default catalog invariant
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
// Control UI i18n script tests cover locale extraction and validation.
|
|
import { describe, expect, it } from "vitest";
|
|
import {
|
|
findPlaceholderMismatches,
|
|
isProviderAuthError,
|
|
resolveTranslationModel,
|
|
} from "../../scripts/control-ui-i18n.ts";
|
|
|
|
describe("control-ui-i18n placeholder validation", () => {
|
|
it("reports missing and extra placeholders by key", () => {
|
|
const mismatches = findPlaceholderMismatches(
|
|
new Map([
|
|
["sessionsView.activeTooltip", "Updated in the last {count} minutes."],
|
|
["sessionsView.store", "Store: {path}"],
|
|
["sessionsView.limitTooltip", "Max sessions to load."],
|
|
]),
|
|
new Map([
|
|
["sessionsView.activeTooltip", "Actualizadas en los últimos N minutos."],
|
|
["sessionsView.store", "Almacén: {path}"],
|
|
["sessionsView.limitTooltip", "Máximo {extra} de sesiones."],
|
|
]),
|
|
"es",
|
|
);
|
|
|
|
expect(mismatches).toEqual([
|
|
{
|
|
key: "sessionsView.activeTooltip",
|
|
locale: "es",
|
|
sourcePlaceholders: ["count"],
|
|
translatedPlaceholders: [],
|
|
},
|
|
{
|
|
key: "sessionsView.limitTooltip",
|
|
locale: "es",
|
|
sourcePlaceholders: [],
|
|
translatedPlaceholders: ["extra"],
|
|
},
|
|
]);
|
|
});
|
|
});
|
|
|
|
describe("control-ui-i18n translation runtime resolution", () => {
|
|
it("uses the in-tree OpenClaw LLM model catalog", () => {
|
|
expect(resolveTranslationModel()).toMatchObject({
|
|
id: "gpt-5.6-sol",
|
|
provider: "openai",
|
|
});
|
|
});
|
|
});
|
|
|
|
describe("control-ui-i18n provider auth errors", () => {
|
|
it("recognizes OpenAI and Anthropic authentication failures", () => {
|
|
expect(isProviderAuthError(new Error("401 Incorrect API key provided"))).toBe(true);
|
|
expect(
|
|
isProviderAuthError(
|
|
new Error(
|
|
'401 {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}',
|
|
),
|
|
),
|
|
).toBe(true);
|
|
expect(isProviderAuthError(new Error("model timed out"))).toBe(false);
|
|
});
|
|
});
|