Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions tests/unit/i18n-missing-placeholder-fallback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ function loadLocale(locale: string): Record<string, unknown> {
return JSON.parse(raw) as Record<string, unknown>;
}

function collectPlaceholderLeaves(
node: unknown,
pathPrefix: string,
out: string[]
): void {
function collectPlaceholderLeaves(node: unknown, pathPrefix: string, out: string[]): void {
if (node === null || typeof node !== "object") {
if (typeof node === "string" && node.startsWith(PLACEHOLDER_PREFIX)) {
out.push(pathPrefix);
Expand All @@ -47,19 +43,13 @@ function collectPlaceholderLeaves(
}

// ---------------------------------------------------------------------------
// 1. Focused repro: the exact keys from the issue report
// 1. (Retired) The original repro asserted zh-TW.json STILL carried raw
// __MISSING__: placeholders. That translation backlog has since been filled, so
// the sentinel no longer ships on disk — the invariant "no locale has a raw
// __MISSING__: leaf" (test 3 below) is the durable guard. Keeping a test that
// requires the backlog to EXIST would fail exactly when the content is healthy.
// ---------------------------------------------------------------------------

test("#7258 repro: zh-TW keys carry a raw __MISSING__: placeholder before the fix is exercised", () => {
const zhTW = loadLocale("zh-TW");
const leaves: string[] = [];
collectPlaceholderLeaves(zhTW, "", leaves);
assert.ok(
leaves.length > 0,
"expected zh-TW.json to still contain __MISSING__: placeholders (translation content backlog)"
);
});

test("#7258: deepMergeFallback replaces an untranslated __MISSING__ placeholder with the EN fallback value", () => {
const target: Record<string, unknown> = {
localUsageCommand: `${PLACEHOLDER_PREFIX}Run this command locally`,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/qianfan-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test("qianfan registers Baidu ERNIE as an OpenAI-compatible API key provider", (

assert.ok(APIKEY_PROVIDERS.qianfan, "qianfan should be visible in API key providers");
assert.equal(APIKEY_PROVIDERS.qianfan.name, "Baidu Qianfan");
assert.equal(APIKEY_PROVIDERS.qianfan.website, "https://cloud.baidu.com/product/wenxinworkshop");
assert.equal(APIKEY_PROVIDERS.qianfan.website, "https://cloud.baidu.com/product-s/qianfan_home");
assert.equal(APIKEY_PROVIDERS.qianfan.passthroughModels, undefined);

assert.equal(PROVIDERS.qianfan.baseUrl, registryEntry.baseUrl);
Expand Down
Loading