Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

test: align coverage with Japanese locale and create-note layout

tianma-ifb346400f6a18
diff --git a/apps/api/src/workspace-provisioning.test.mjs b/apps/api/src/workspace-provisioning.test.mjs
index 0e6283b9..d4ebae0f 100644
--- a/apps/api/src/workspace-provisioning.test.mjs
+++ b/apps/api/src/workspace-provisioning.test.mjs
@@ -73,7 +73,7 @@ describe("workspace provisioning", () => {
expect(calls.some((call) => call.sql.includes("INSERT OR IGNORE INTO ai_prompt_templates"))).toBe(true);
});
- test("seeds English templates when Accept-Language is neither Chinese nor English", () => {
+ test("seeds Japanese templates when Accept-Language prefers Japanese", () => {
const calls = [];
const db = {
prepare: (sql) => statement(sql, calls),
@@ -86,6 +86,22 @@ describe("workspace provisioning", () => {
"ja-JP,ja;q=0.9",
);
+ expect(calls[0].values).toContain("ひらめきメモ");
+ });
+
+ test("seeds English templates when Accept-Language is unmatched", () => {
+ const calls = [];
+ const db = {
+ prepare: (sql) => statement(sql, calls),
+ };
+
+ createWorkspaceDefaultSeedStatements(
+ db,
+ "ws_fr",
+ "2026-08-14T00:00:00.000Z",
+ "fr-FR,fr;q=0.9",
+ );
+
expect(calls[0].values).toContain("Quick Spark");
});
});
diff --git a/apps/web/src/components/NotebookPane.test.mjs b/apps/web/src/components/NotebookPane.test.mjs
index e8620248..43021d05 100644
--- a/apps/web/src/components/NotebookPane.test.mjs
+++ b/apps/web/src/components/NotebookPane.test.mjs
@@ -11,13 +11,18 @@ test("keeps proactive AI out of primary navigation", () => {
});
test("keeps the desktop create-note control compact with one neutral outline", () => {
+ const css = readFileSync(new URL("../styles/globals.css", import.meta.url), "utf8");
+
expect(source).toContain('rounded-2xl border border-slate-200/90');
- expect(source).toContain('className="group flex h-12');
- expect(source).toContain('className="group relative flex h-12 w-[6.25rem]');
+ expect(source).toContain('className="group flex h-12 max-w-[calc(100%-2.25rem)]');
+ expect(source).toContain('className="group relative flex h-12 min-w-9 flex-1');
expect(source).toContain('before:inset-y-2.5');
expect(source).toContain('data-[state=open]:bg-emerald-50');
expect(source).toContain('t("diagram.moreTypes")');
expect(source).toContain('group-data-[state=open]:rotate-180');
+ expect(source).toContain("edgeever-create-memo-split__more-label");
+ expect(css).toContain(".edgeever-create-memo-split__more-label");
+ expect(css).toContain("@container (max-width: 11.749rem)");
expect(source).not.toContain('focus-visible:ring-inset focus-visible:ring-emerald-500');
expect(source).not.toContain('title={t("notebookPane.newMemo")}');
});
diff --git a/apps/web/src/i18n/locales.test.mjs b/apps/web/src/i18n/locales.test.mjs
index 54cbcf4c..7e9e5ca8 100644
--- a/apps/web/src/i18n/locales.test.mjs
+++ b/apps/web/src/i18n/locales.test.mjs
@@ -36,16 +36,23 @@ describe("web locale resolution", () => {
expect(normalizeLocale("zh-Hans")).toBe("zh-CN");
});
- test("falls unmatched browser languages back to English instead of Chinese", () => {
+ test("keeps Japanese browser languages on the shipped ja locale", () => {
setNavigatorLanguages(["ja-JP", "ja"]);
- expect(getBrowserLocale()).toBe("en-US");
+ expect(getBrowserLocale()).toBe("ja");
+ });
+
+ test("falls unmatched browser languages back to English instead of Chinese", () => {
setNavigatorLanguages(["fr-FR", "de-DE"]);
+ expect(getBrowserLocale()).toBe("en-US");
+ setNavigatorLanguages(["ko-KR"]);
expect(getInitialLocale()).toBe("en-US");
expect(defaultLocale).toBe("zh-CN");
});
test("uses the first supported language in the browser preference list", () => {
setNavigatorLanguages(["ja-JP", "zh-CN"]);
+ expect(getBrowserLocale()).toBe("ja");
+ setNavigatorLanguages(["fr-FR", "zh-CN"]);
expect(getBrowserLocale()).toBe("zh-CN");
});
});
diff --git a/packages/shared/src/memo-template-seeds.test.mjs b/packages/shared/src/memo-template-seeds.test.mjs
index e6c1c2cf..1a7e86ba 100644
--- a/packages/shared/src/memo-template-seeds.test.mjs
+++ b/packages/shared/src/memo-template-seeds.test.mjs
@@ -6,12 +6,13 @@ import {
} from "./memo-template-seeds.ts";
describe("memo template seeds", () => {
- test("provides five unique editable starter templates in both supported languages", () => {
+ test("provides five unique editable starter templates in Chinese, English, and Japanese", () => {
expect(DEFAULT_MEMO_TEMPLATE_SEEDS).toHaveLength(5);
expect(new Set(DEFAULT_MEMO_TEMPLATE_SEEDS.map((seed) => seed.key)).size).toBe(5);
expect(localizeMemoTemplateSeed(DEFAULT_MEMO_TEMPLATE_SEEDS[0], "zh-CN").title).toBe("灵感速记");
expect(localizeMemoTemplateSeed(DEFAULT_MEMO_TEMPLATE_SEEDS[0], "en-GB").title).toBe("Quick Spark");
- expect(localizeMemoTemplateSeed(DEFAULT_MEMO_TEMPLATE_SEEDS[0], "ja-JP").title).toBe("Quick Spark");
+ expect(localizeMemoTemplateSeed(DEFAULT_MEMO_TEMPLATE_SEEDS[0], "ja-JP").title).toBe("ひらめきメモ");
+ expect(localizeMemoTemplateSeed(DEFAULT_MEMO_TEMPLATE_SEEDS[0], "ko-KR").title).toBe("Quick Spark");
expect(localizeMemoTemplateSeed(DEFAULT_MEMO_TEMPLATE_SEEDS[0], null).title).toBe("灵感速记");
});
diff --git a/tests/mobile-ai-assistant.test.ts b/tests/mobile-ai-assistant.test.ts
index a7456004..c658ac03 100644
--- a/tests/mobile-ai-assistant.test.ts
+++ b/tests/mobile-ai-assistant.test.ts
@@ -79,7 +79,7 @@ describe("native mobile AI note assistant", () => {
});
test("keeps the assistant reachable from each native note action menu", () => {
- expect(androidDetailSource).toContain('label={resolvedLocale === "en-US" ? "AI note assistant" : "AI 笔记助手"}');
+ expect(androidDetailSource).toContain('label={resolvedLocale !== "zh-CN" ? "AI note assistant" : "AI 笔记助手"}');
expect(androidDetailSource).toContain("setAiAssistantOpen(true)");
expect(androidDetailSource).toContain("<MobileAiAssistantModal");
expect(iosDetailSource).toContain('env.preferences.t("AI 笔记助手", en: "AI note assistant")');
diff --git a/tests/note-id-copy.test.ts b/tests/note-id-copy.test.ts
index 7b49560a..982cf01d 100644
--- a/tests/note-id-copy.test.ts
+++ b/tests/note-id-copy.test.ts
@@ -24,7 +24,7 @@ describe("copy current note ID", () => {
test("copies the raw memo ID from both native mobile clients", () => {
expect(androidDetailSource).toContain("Clipboard.setStringAsync(memo.id)");
- expect(androidDetailSource).toContain('resolvedLocale === "en-US" ? "Copy note ID" : "复制笔记 ID"');
+ expect(androidDetailSource).toContain('resolvedLocale !== "zh-CN" ? "Copy note ID" : "复制笔记 ID"');
expect(androidDetailSource).toContain("disabled={!canCopyMemoId}");
expect(iosDetailSource).toContain("UIPasteboard.general.string = memo.id");
expect(iosDetailSource).toContain('env.preferences.t("复制笔记 ID", en: "Copy note ID")');