test(memhub): align localization fixtures with current keys
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
bf811ce7bb
commit
cfbf7e9fe0
7 files changed
+37
-17
No files matched your search
@@ -426,7 +426,7 @@ it("does not claim delivery for a call Core never completed", async () => {
|
||||
const detail = screen.getByRole("article", { name: "调用详情" });
|
||||
expect(within(detail).queryByText(/已返回给/)).toBeNull();
|
||||
expect(
|
||||
within(detail).getByText("One Memory 暂时不可用,这次回答没有带上记忆。"),
|
||||
within(detail).getByText("MemHub 暂时不可用,这次回答没有带上记忆。"),
|
||||
).toBeTruthy();
|
||||
});
|
||||
it("does not restate an undelivered result as returned", async () => {
|
||||
@@ -486,7 +486,7 @@ it.each([
|
||||
"查询超时,没有提供记忆",
|
||||
"直接调用(诊断) 这次没来得及查到记忆",
|
||||
],
|
||||
["unavailable", "One Memory 暂时不可用", "直接调用(诊断) 暂时无法查记忆"],
|
||||
["unavailable", "MemHub 暂时不可用", "直接调用(诊断) 暂时无法查记忆"],
|
||||
["denied", "当前未授权查询", "直接调用(诊断) 未获准查记忆"],
|
||||
] as const)(
|
||||
"renders the %s state without claiming external adoption",
|
||||
@@ -543,7 +543,7 @@ it("does not call an unavailable call returned", async () => {
|
||||
const detail = screen.getByRole("article", { name: "调用详情" });
|
||||
expect(within(detail).queryByText(/· 已返回/)).toBeNull();
|
||||
expect(
|
||||
within(detail).getAllByText(/One Memory 暂时不可用/).length,
|
||||
within(detail).getAllByText(/MemHub 暂时不可用/).length,
|
||||
).toBeGreaterThan(0);
|
||||
expect(within(detail).queryByText(/采用未确认|Core/)).toBeNull();
|
||||
});
|
||||
|
||||
@@ -11,7 +11,11 @@ import {
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { afterEach, beforeEach, expect, it, vi } from "vitest";
|
||||
import { DebugLogPanel } from "./DebugLogPanel";
|
||||
import { LanguageProvider, useGuiLanguage } from "./gui-language";
|
||||
import {
|
||||
LANGUAGE_STORAGE_KEY,
|
||||
LanguageProvider,
|
||||
useGuiLanguage,
|
||||
} from "./gui-language";
|
||||
import {
|
||||
recordRendererDebugLog,
|
||||
resetRendererDebugLogsForTest,
|
||||
@@ -117,7 +121,7 @@ it("translates controls live but preserves events and does not change capture",
|
||||
// A language bridge is not required by this synthetic browser fixture.
|
||||
const read = vi.fn().mockResolvedValue(snapshot);
|
||||
window.oneMemory = undefined;
|
||||
localStorage.setItem("one-memory.gui-language", "es");
|
||||
localStorage.setItem(LANGUAGE_STORAGE_KEY, "es");
|
||||
const view = render(
|
||||
<LanguageProvider>
|
||||
<SwitchLanguage />
|
||||
@@ -311,7 +315,7 @@ it("shows the diagnostics tabs and model usage in Spanish without Chinese copy",
|
||||
// Browser-mode language, then the desktop log bridge, as in the test above.
|
||||
const bridge = window.oneMemory;
|
||||
window.oneMemory = undefined;
|
||||
localStorage.setItem("one-memory.gui-language", "es");
|
||||
localStorage.setItem(LANGUAGE_STORAGE_KEY, "es");
|
||||
const view = render(
|
||||
<LanguageProvider>
|
||||
<DebugLogPanel />
|
||||
|
||||
@@ -11,7 +11,11 @@ import {
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { FirstUseGuide, FirstUseInvitation } from "./FirstUseGuide";
|
||||
import { LanguageProvider, useGuiLanguage } from "./gui-language";
|
||||
import {
|
||||
LANGUAGE_STORAGE_KEY,
|
||||
LanguageProvider,
|
||||
useGuiLanguage,
|
||||
} from "./gui-language";
|
||||
|
||||
function GuideLanguageSwitch() {
|
||||
const { setPreference } = useGuiLanguage();
|
||||
@@ -24,7 +28,7 @@ function GuideLanguageSwitch() {
|
||||
|
||||
it("localizes the supported guide without changing original memory or copying", async () => {
|
||||
window.oneMemory = undefined;
|
||||
localStorage.setItem("one-memory.gui-language", "es");
|
||||
localStorage.setItem(LANGUAGE_STORAGE_KEY, "es");
|
||||
render(
|
||||
<LanguageProvider>
|
||||
<GuideLanguageSwitch />
|
||||
|
||||
@@ -13,7 +13,11 @@ import { cleanup, render, screen, waitFor } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { GraphWidthPrompt } from "./GraphWidthPrompt";
|
||||
import { LanguageProvider, useGuiLanguage } from "./gui-language";
|
||||
import {
|
||||
LANGUAGE_STORAGE_KEY,
|
||||
LanguageProvider,
|
||||
useGuiLanguage,
|
||||
} from "./gui-language";
|
||||
|
||||
function LanguageSwitch() {
|
||||
const { setPreference } = useGuiLanguage();
|
||||
@@ -58,7 +62,7 @@ describe("GraphWidthPrompt", () => {
|
||||
});
|
||||
|
||||
it("translates the mismatch and live switch without requesting or confirming twice", async () => {
|
||||
window.localStorage.setItem("one-memory.gui-language", "es");
|
||||
window.localStorage.setItem(LANGUAGE_STORAGE_KEY, "es");
|
||||
const user = userEvent.setup();
|
||||
render(
|
||||
<LanguageProvider>
|
||||
@@ -92,7 +96,7 @@ describe("GraphWidthPrompt", () => {
|
||||
expect.any(String),
|
||||
),
|
||||
);
|
||||
window.localStorage.removeItem("one-memory.gui-language");
|
||||
window.localStorage.removeItem(LANGUAGE_STORAGE_KEY);
|
||||
});
|
||||
|
||||
it("moves focus into the modal and keeps Tab inside it", async () => {
|
||||
|
||||
@@ -12,7 +12,11 @@ import {
|
||||
import { StrictMode } from "react";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { LanguageProvider, useGuiLanguage } from "./gui-language";
|
||||
import {
|
||||
LANGUAGE_STORAGE_KEY,
|
||||
LanguageProvider,
|
||||
useGuiLanguage,
|
||||
} from "./gui-language";
|
||||
import { HealthPanel } from "./HealthPanel";
|
||||
import type { ImportSourcesController } from "./use-import-sources";
|
||||
|
||||
@@ -37,7 +41,7 @@ function HealthLanguageSwitch() {
|
||||
|
||||
it("shows supported diagnostics in Spanish without toggling logging", async () => {
|
||||
window.oneMemory = undefined;
|
||||
localStorage.setItem("one-memory.gui-language", "es");
|
||||
localStorage.setItem(LANGUAGE_STORAGE_KEY, "es");
|
||||
render(
|
||||
<LanguageProvider>
|
||||
<HealthLanguageSwitch />
|
||||
@@ -676,7 +680,7 @@ describe("HealthPanel", () => {
|
||||
});
|
||||
|
||||
it("read receipt timestamps follow the Spanish interface language", async () => {
|
||||
localStorage.setItem("one-memory.gui-language", "es");
|
||||
localStorage.setItem(LANGUAGE_STORAGE_KEY, "es");
|
||||
try {
|
||||
render(
|
||||
<LanguageProvider>
|
||||
|
||||
@@ -12,7 +12,11 @@ import userEvent from "@testing-library/user-event";
|
||||
import { useState } from "react";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { LanguageProvider, useGuiLanguage } from "./gui-language";
|
||||
import {
|
||||
LANGUAGE_STORAGE_KEY,
|
||||
LanguageProvider,
|
||||
useGuiLanguage,
|
||||
} from "./gui-language";
|
||||
import { ImportProgressStrip } from "./ImportProgressStrip";
|
||||
|
||||
function job(overrides: Partial<ImportJob> = {}): ImportJob {
|
||||
@@ -86,7 +90,7 @@ describe("ImportProgressStrip", () => {
|
||||
afterEach(cleanup);
|
||||
|
||||
it("translates user-facing progress and live settings CTA without invoking actions", async () => {
|
||||
localStorage.setItem("one-memory.gui-language", "es");
|
||||
localStorage.setItem(LANGUAGE_STORAGE_KEY, "es");
|
||||
const open = vi.fn();
|
||||
function Switch() {
|
||||
const { setPreference } = useGuiLanguage();
|
||||
|
||||
@@ -84,7 +84,7 @@ it("traduce entrega y límites sin atribuir adopción ni alterar anfitriones des
|
||||
"Parte del contenido sigue procesándose.",
|
||||
);
|
||||
expect(callReturnDeliveryLabel({ ...event, state: "unavailable" })).toBe(
|
||||
"One Memory 暂时不可用,这次回答没有带上记忆。",
|
||||
"MemHub 暂时不可用,这次回答没有带上记忆。",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user