惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
C
Check Point Blog
Vercel News
Vercel News
Y
Y Combinator Blog
G
Google Developers Blog
P
Proofpoint News Feed
WordPress大学
WordPress大学
MongoDB | Blog
MongoDB | Blog
博客园 - 司徒正美
Last Week in AI
Last Week in AI
博客园 - 【当耐特】
N
Netflix TechBlog - Medium
L
LangChain Blog
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
博客园_首页
B
Blog RSS Feed
The Cloudflare Blog
MyScale Blog
MyScale Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Security Blog
Microsoft Security Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test: reduce repeated test setup overhead · openclaw/open...
steipete · 2026-04-27 · via Recent Commits to openclaw:main

@@ -1,6 +1,6 @@

11

import fs from "node:fs";

22

import { fileURLToPath } from "node:url";

3-

import { beforeAll, describe, expect, it } from "vitest";

3+

import { describe, expect, it } from "vitest";

4455

type TranslationTree = {

66

readonly [key: string]: string | TranslationTree | undefined;

@@ -18,7 +18,17 @@ const describeWhenUiI18nPresent = fs.existsSync(fileURLToPath(registryModuleUrl)

1818

? describe

1919

: describe.skip;

202021-

let registry: LocaleRegistry;

21+

const registry =

22+

describeWhenUiI18nPresent === describe

23+

? ((await import("../../ui/src/i18n/lib/registry.ts")) as LocaleRegistry)

24+

: undefined;

25+26+

function getRegistry(): LocaleRegistry {

27+

if (registry === undefined) {

28+

throw new Error("expected UI i18n registry to be present");

29+

}

30+

return registry;

31+

}

22322333

function getNestedTranslation(map: TranslationTree | null, ...path: string[]): string | undefined {

2434

let value: string | TranslationTree | undefined = map ?? undefined;

@@ -32,12 +42,10 @@ function getNestedTranslation(map: TranslationTree | null, ...path: string[]): s

3242

}

33433444

describeWhenUiI18nPresent("ui i18n locale registry", () => {

35-

beforeAll(async () => {

36-

registry = (await import("../../ui/src/i18n/lib/registry.ts")) as LocaleRegistry;

37-

});

38-3945

it("lists supported locales", () => {

40-

expect(registry.SUPPORTED_LOCALES).toEqual([

46+

const localeRegistry = getRegistry();

47+48+

expect(localeRegistry.SUPPORTED_LOCALES).toEqual([

4149

"en",

4250

"zh-CN",

4351

"zh-TW",

@@ -53,34 +61,37 @@ describeWhenUiI18nPresent("ui i18n locale registry", () => {

5361

"pl",

5462

"th",

5563

]);

56-

expect(registry.DEFAULT_LOCALE).toBe("en");

64+

expect(localeRegistry.DEFAULT_LOCALE).toBe("en");

5765

});

58665967

it("resolves browser locale fallbacks", () => {

60-

expect(registry.resolveNavigatorLocale("de-DE")).toBe("de");

61-

expect(registry.resolveNavigatorLocale("es-ES")).toBe("es");

62-

expect(registry.resolveNavigatorLocale("es-MX")).toBe("es");

63-

expect(registry.resolveNavigatorLocale("pt-PT")).toBe("pt-BR");

64-

expect(registry.resolveNavigatorLocale("zh-HK")).toBe("zh-TW");

65-

expect(registry.resolveNavigatorLocale("en-US")).toBe("en");

66-

expect(registry.resolveNavigatorLocale("ja-JP")).toBe("ja-JP");

67-

expect(registry.resolveNavigatorLocale("ko-KR")).toBe("ko");

68-

expect(registry.resolveNavigatorLocale("fr-CA")).toBe("fr");

69-

expect(registry.resolveNavigatorLocale("tr-TR")).toBe("tr");

70-

expect(registry.resolveNavigatorLocale("uk-UA")).toBe("uk");

71-

expect(registry.resolveNavigatorLocale("id-ID")).toBe("id");

72-

expect(registry.resolveNavigatorLocale("pl-PL")).toBe("pl");

73-

expect(registry.resolveNavigatorLocale("th-TH")).toBe("th");

68+

const localeRegistry = getRegistry();

69+70+

expect(localeRegistry.resolveNavigatorLocale("de-DE")).toBe("de");

71+

expect(localeRegistry.resolveNavigatorLocale("es-ES")).toBe("es");

72+

expect(localeRegistry.resolveNavigatorLocale("es-MX")).toBe("es");

73+

expect(localeRegistry.resolveNavigatorLocale("pt-PT")).toBe("pt-BR");

74+

expect(localeRegistry.resolveNavigatorLocale("zh-HK")).toBe("zh-TW");

75+

expect(localeRegistry.resolveNavigatorLocale("en-US")).toBe("en");

76+

expect(localeRegistry.resolveNavigatorLocale("ja-JP")).toBe("ja-JP");

77+

expect(localeRegistry.resolveNavigatorLocale("ko-KR")).toBe("ko");

78+

expect(localeRegistry.resolveNavigatorLocale("fr-CA")).toBe("fr");

79+

expect(localeRegistry.resolveNavigatorLocale("tr-TR")).toBe("tr");

80+

expect(localeRegistry.resolveNavigatorLocale("uk-UA")).toBe("uk");

81+

expect(localeRegistry.resolveNavigatorLocale("id-ID")).toBe("id");

82+

expect(localeRegistry.resolveNavigatorLocale("pl-PL")).toBe("pl");

83+

expect(localeRegistry.resolveNavigatorLocale("th-TH")).toBe("th");

7484

});

75857686

it("loads lazy locale translations from the registry", async () => {

87+

const localeRegistry = getRegistry();

7788

const [de, es, ptBR, zhCN, th, en] = await Promise.all([

78-

registry.loadLazyLocaleTranslation("de"),

79-

registry.loadLazyLocaleTranslation("es"),

80-

registry.loadLazyLocaleTranslation("pt-BR"),

81-

registry.loadLazyLocaleTranslation("zh-CN"),

82-

registry.loadLazyLocaleTranslation("th"),

83-

registry.loadLazyLocaleTranslation("en"),

89+

localeRegistry.loadLazyLocaleTranslation("de"),

90+

localeRegistry.loadLazyLocaleTranslation("es"),

91+

localeRegistry.loadLazyLocaleTranslation("pt-BR"),

92+

localeRegistry.loadLazyLocaleTranslation("zh-CN"),

93+

localeRegistry.loadLazyLocaleTranslation("th"),

94+

localeRegistry.loadLazyLocaleTranslation("en"),

8495

]);

85968697

expect(getNestedTranslation(de, "common", "health")).toBe("Status");