settingsDataBaseDirControl.test.ts 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. import { createElement } from "react";
  2. import { renderToStaticMarkup } from "react-dom/server";
  3. import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
  4. import enUS from "../src/i18n/locales/en-US.js";
  5. import zhCN from "../src/i18n/locales/zh-CN.js";
  6. const capturedButtons: Array<Record<string, unknown>> = [];
  7. const capturedInputs: Array<Record<string, unknown>> = [];
  8. const capturedSwitches: Array<Record<string, unknown>> = [];
  9. const EXPECTED_SHELL_DESCRIPTION_ZH =
  10. "仅新会话生效。Windows 下 Bash 工具用此 shell;自动优先 Git Bash,找不到回退 cmd.exe。";
  11. const EXPECTED_SHELL_DESCRIPTION_EN =
  12. "Applies to new sessions only. On Windows, Bash uses this shell; Auto tries Git Bash, then cmd.exe.";
  13. const EXPECTED_NATIVE_SEARCH_DESCRIPTION_ZH =
  14. "在新建会话或应用重启后恢复的会话中使用增强 Find 和 Grep。当前会话保持现有设置;Windows 的 Find 保持不变。";
  15. const EXPECTED_NATIVE_SEARCH_DESCRIPTION_EN =
  16. "Use enhanced Find and Grep in new sessions and sessions restored after an app restart. Active sessions keep their current setting; Find remains unchanged on Windows.";
  17. const EXPECTED_MEMORY_DESCRIPTION_ZH =
  18. "在工作区中保存并复用长期上下文,新会话生效。开启后可能增加模型调用和 Token 成本。";
  19. const EXPECTED_MEMORY_DESCRIPTION_EN =
  20. "Save and reuse long-term context in workspaces. Applies to new sessions and may increase model requests and token costs.";
  21. const EXPECTED_ASK_AUTO_RESOLUTION_DESCRIPTION_ZH =
  22. "开启后,Agent 提问 5 分钟未回答会自动继续;关闭后,当前和后续提问会一直等待你的回答。";
  23. const EXPECTED_ASK_AUTO_RESOLUTION_DESCRIPTION_EN =
  24. "When enabled, Agent questions automatically continue after 5 minutes without an answer. When disabled, current and future questions wait for your response.";
  25. const EXPECTED_MODEL_IO_FULL_RETENTION_DESCRIPTION_ZH =
  26. "保留完整的模型请求和响应,不自动压缩、限制大小或删除旧记录。";
  27. const EXPECTED_MODEL_IO_FULL_RETENTION_DESCRIPTION_EN =
  28. "Keep complete model requests and responses without compression, size limits, or automatic deletion.";
  29. vi.mock("react", async () => {
  30. const actual = await vi.importActual<typeof import("react")>("react");
  31. return {
  32. ...actual,
  33. useState: (initialValue: unknown) => [initialValue, vi.fn()] as const,
  34. };
  35. });
  36. vi.mock("@/components/lib/utils.js", () => ({
  37. cn: (...values: Array<string | false | null | undefined>) => values.filter(Boolean).join(" "),
  38. }));
  39. vi.mock("@/components/ui/button.js", () => ({
  40. Button: ({ children, ...props }: { children: unknown; [key: string]: unknown }) => {
  41. capturedButtons.push({ children, ...props });
  42. return createElement("button", props, children);
  43. },
  44. }));
  45. vi.mock("@/components/ui/input.js", () => ({
  46. Input: (props: Record<string, unknown>) => {
  47. capturedInputs.push(props);
  48. return createElement("input", props);
  49. },
  50. }));
  51. vi.mock("@/components/ui/switch.js", () => ({
  52. Switch: (props: Record<string, unknown>) => {
  53. capturedSwitches.push(props);
  54. return createElement("input", { type: "checkbox", ...props });
  55. },
  56. }));
  57. vi.mock("@/components/ui/select.js", () => ({
  58. Select: ({ children }: { children: unknown }) => createElement("div", null, children),
  59. SelectContent: ({ children }: { children: unknown }) => createElement("div", null, children),
  60. SelectItem: ({ children }: { children: unknown }) => createElement("div", null, children),
  61. SelectTrigger: ({ children }: { children: unknown }) => createElement("button", null, children),
  62. SelectValue: () => createElement("span"),
  63. }));
  64. vi.mock("@/components/ui/card.js", () => ({
  65. Card: ({ children, ...props }: { children: unknown; [key: string]: unknown }) =>
  66. createElement("div", props, children),
  67. CardContent: ({ children, ...props }: { children: unknown; [key: string]: unknown }) =>
  68. createElement("div", props, children),
  69. }));
  70. vi.mock("@/settings/SettingsPageParts.js", () => ({
  71. SettingsBadge: ({ children }: { children: unknown }) => createElement("span", null, children),
  72. SettingsGroupCard: ({ children }: { children: unknown }) =>
  73. createElement("section", { "data-settings-group": true }, children),
  74. SettingsRow: ({
  75. control,
  76. description,
  77. detail,
  78. }: {
  79. control: unknown;
  80. description?: unknown;
  81. detail?: unknown;
  82. }) => createElement("div", null, description, control, detail),
  83. }));
  84. vi.mock("@/i18n/IntlProvider.js", () => ({
  85. useZCodeIntl: () => ({
  86. intl: {
  87. formatMessage: ({ id }: { id: string }) => {
  88. const messages: Record<string, string> = {
  89. "settings.themeMode": "主题模式",
  90. "settings.themeMode.system": "跟随系统",
  91. "settings.themeMode.dark": "深色",
  92. "settings.themeMode.light": "浅色",
  93. "settings.themeMode.zai-dark": "深色",
  94. "settings.themeMode.zai-light": "浅色",
  95. "settings.locale": "界面语言",
  96. "settings.locale.system": "系统默认",
  97. "settings.locale.zh-CN": "简体中文",
  98. "settings.locale.en-US": "English",
  99. "settings.terminalProfile": "继承系统终端 Profile",
  100. "settings.terminalProfileDescription": "desc",
  101. "settings.terminalFontFamily": "终端字体",
  102. "settings.terminalFontFamilyDescription": "desc",
  103. "settings.terminalFontFamilyPlaceholder": "留空自动继承",
  104. "settings.integratedTerminalShell": "集成终端Shell",
  105. "settings.integratedTerminalShellDescription": EXPECTED_SHELL_DESCRIPTION_ZH,
  106. "settings.integratedTerminalShell.auto": "自动选择",
  107. "settings.nativeSearchEnhancements": "增强 Find 和 Grep",
  108. "settings.nativeSearchEnhancementsDescription": EXPECTED_NATIVE_SEARCH_DESCRIPTION_ZH,
  109. "settings.memory": "记忆",
  110. "settings.memory.workspaceMemory": "工作区记忆",
  111. "settings.memoryDescription": EXPECTED_MEMORY_DESCRIPTION_ZH,
  112. "settings.desktopChromiumHardwareAcceleration": "Chrome 硬件加速",
  113. "settings.desktopChromiumHardwareAccelerationDescription": "desc",
  114. "settings.notification": "任务通知",
  115. "settings.notificationDescription": "desc",
  116. "settings.notificationSound": "通知声音",
  117. "settings.notificationSoundDescription": "desc",
  118. "settings.messageStreamShowReasoning": "显示思考过程",
  119. "settings.messageStreamShowReasoningDescription": "desc",
  120. "settings.messageStreamShowTodos": "显示流式待办",
  121. "settings.messageStreamShowTodosDescription": "desc",
  122. "settings.toolGroupingExplore": "分组探索工具",
  123. "settings.toolGroupingExploreDescription": "desc",
  124. "settings.toolGroupingTerminal": "分组终端命令",
  125. "settings.toolGroupingTerminalDescription": "desc",
  126. "settings.toolGroupingChanges": "分组文件更改",
  127. "settings.toolGroupingChangesDescription": "desc",
  128. "settings.zcodeInteractionBehavior": "交互行为",
  129. "settings.zcodeInteractionBehaviorDescription": "desc",
  130. "settings.zcodeInteractionBehavior.option.queue": "队列",
  131. "settings.zcodeInteractionBehavior.option.guide": "引导",
  132. "settings.askUserQuestionAutoResolution": "提问自动继续",
  133. "settings.askUserQuestionAutoResolutionDescription":
  134. EXPECTED_ASK_AUTO_RESOLUTION_DESCRIPTION_ZH,
  135. "settings.modelIoFullRetention": "完整保留模型 I/O",
  136. "settings.modelIoFullRetentionDescription":
  137. EXPECTED_MODEL_IO_FULL_RETENTION_DESCRIPTION_ZH,
  138. "settings.performanceMode": "性能模式",
  139. "settings.performanceModeDescription": "desc",
  140. "settings.taskAutoArchive": "自动归档旧任务",
  141. "settings.taskAutoArchiveDescription": "desc",
  142. "settings.taskAutoArchiveDays": "归档保留时长",
  143. "settings.taskAutoArchiveDaysDescription": "desc",
  144. "settings.taskAutoArchiveDays.option.3": "3 天后归档",
  145. "settings.taskAutoArchiveDays.option.7": "7 天后归档",
  146. "settings.taskAutoArchiveDays.option.14": "14 天后归档",
  147. "settings.taskAutoArchiveDays.option.30": "30 天后归档",
  148. "settings.dataBaseDir": "数据存储路径",
  149. "settings.dataBaseDirDescription": "desc",
  150. "settings.dataBaseDirPlaceholder": "默认:用户主目录",
  151. "settings.dataBaseDirBrowse": "选择文件夹",
  152. "settings.dataBaseDirSave": "保存",
  153. };
  154. return messages[id] ?? id;
  155. },
  156. },
  157. }),
  158. }));
  159. function findButton(label: string) {
  160. return capturedButtons.find((button) => button.children === label);
  161. }
  162. async function renderGeneralSection(
  163. overrides: Partial<
  164. Parameters<typeof import("../src/settingsPageHelpers.js").GeneralSectionContent>[0]
  165. > = {},
  166. ) {
  167. const { GeneralSectionContent } = await import("../src/settingsPageHelpers.js");
  168. return renderToStaticMarkup(
  169. createElement(GeneralSectionContent, {
  170. theme: "system",
  171. localePreference: "system",
  172. notificationEnabled: true,
  173. notificationSoundEnabled: true,
  174. closeToTrayOnWindows: true,
  175. keepAwakeWhileRunning: false,
  176. isDesktop: true,
  177. receivePreviewUpdates: false,
  178. autoDownloadAndInstallUpdates: false,
  179. desktopChromiumHardwareAccelerationEnabled: true,
  180. dataBaseDir: "/Users/test",
  181. terminalInheritSystemProfile: true,
  182. terminalFontFamily: "",
  183. nativeSearchEnhancementsEnabled: true,
  184. defaultHomeDir: "/Users/test",
  185. setTheme: vi.fn(),
  186. setLocalePreference: vi.fn(),
  187. setNotificationEnabled: vi.fn(),
  188. setNotificationSoundEnabled: vi.fn(),
  189. taskAutoArchiveEnabled: false,
  190. taskAutoArchiveOlderThanDays: 7,
  191. messageStreamShowReasoning: true,
  192. messageStreamShowTodos: false,
  193. toolGroupingExploreEnabled: true,
  194. toolGroupingTerminalEnabled: true,
  195. toolGroupingChangesEnabled: false,
  196. zcodeInteractionBehavior: "queue",
  197. askUserQuestionAutoResolutionEnabled: true,
  198. modelIoFullRetentionEnabled: false,
  199. onDataBaseDirChange: vi.fn(async () => {}),
  200. onSelectDataBaseDir: vi.fn(async () => "/Users/test/data"),
  201. onTerminalInheritSystemProfileChange: vi.fn(async () => {}),
  202. onTerminalFontFamilyChange: vi.fn(async () => {}),
  203. onNativeSearchEnhancementsEnabledChange: vi.fn(async () => {}),
  204. onDesktopChromiumHardwareAccelerationChange: vi.fn(async () => {}),
  205. onTaskAutoArchiveEnabledChange: vi.fn(async () => {}),
  206. onTaskAutoArchiveOlderThanDaysChange: vi.fn(async () => {}),
  207. onCloseToTrayOnWindowsChange: vi.fn(async () => {}),
  208. onKeepAwakeWhileRunningChange: vi.fn(async () => {}),
  209. onReceivePreviewUpdatesChange: vi.fn(async () => {}),
  210. onAutoDownloadAndInstallUpdatesChange: vi.fn(async () => {}),
  211. onMessageStreamShowReasoningChange: vi.fn(async () => {}),
  212. onMessageStreamShowTodosChange: vi.fn(async () => {}),
  213. onToolGroupingExploreEnabledChange: vi.fn(async () => {}),
  214. onToolGroupingTerminalEnabledChange: vi.fn(async () => {}),
  215. onToolGroupingChangesEnabledChange: vi.fn(async () => {}),
  216. onZCodeInteractionBehaviorChange: vi.fn(async () => {}),
  217. onAskUserQuestionAutoResolutionEnabledChange: vi.fn(async () => {}),
  218. onModelIoFullRetentionEnabledChange: vi.fn(async () => {}),
  219. onOptimizeAgentExperienceEnabledChange: vi.fn(async () => {}),
  220. onOpenOnboardingDialog: vi.fn(),
  221. ...overrides,
  222. }),
  223. );
  224. }
  225. describe("GeneralSectionContent data directory control", () => {
  226. beforeEach(() => {
  227. capturedButtons.length = 0;
  228. capturedInputs.length = 0;
  229. capturedSwitches.length = 0;
  230. });
  231. afterEach(() => {
  232. vi.resetModules();
  233. });
  234. it("数据目录改为只读展示,避免继续手输路径", async () => {
  235. await renderGeneralSection();
  236. expect(capturedInputs.some((input) => input.readOnly === true)).toBe(true);
  237. expect(findButton("保存")?.disabled).toBe(true);
  238. });
  239. it("ModelIO 全量保留默认关闭,并通过标准设置开关提交", async () => {
  240. const onModelIoFullRetentionEnabledChange = vi.fn(async () => {});
  241. await renderGeneralSection({ onModelIoFullRetentionEnabledChange });
  242. const modelIoSwitch = capturedSwitches.find(
  243. (entry) => entry["aria-label"] === "完整保留模型 I/O",
  244. );
  245. expect(modelIoSwitch?.checked).toBe(false);
  246. expect(modelIoSwitch?.onCheckedChange).toBeTypeOf("function");
  247. (modelIoSwitch?.onCheckedChange as ((checked: boolean) => void) | undefined)?.(true);
  248. expect(onModelIoFullRetentionEnabledChange).toHaveBeenCalledWith(true);
  249. expect(zhCN["settings.modelIoFullRetentionDescription"]).toBe(
  250. EXPECTED_MODEL_IO_FULL_RETENTION_DESCRIPTION_ZH,
  251. );
  252. expect(enUS["settings.modelIoFullRetentionDescription"]).toBe(
  253. EXPECTED_MODEL_IO_FULL_RETENTION_DESCRIPTION_EN,
  254. );
  255. });
  256. it("点击选择文件夹会调用系统目录选择回调", async () => {
  257. const onSelectDataBaseDir = vi.fn(async () => "/Users/test/data");
  258. await renderGeneralSection({ onSelectDataBaseDir });
  259. await (findButton("选择文件夹")?.onClick as (() => Promise<void>) | undefined)?.();
  260. expect(onSelectDataBaseDir).toHaveBeenCalledTimes(1);
  261. });
  262. it("Windows host 会展示集成终端 Shell 下拉选项", async () => {
  263. const markup = await renderGeneralSection({
  264. showIntegratedTerminalShell: true,
  265. integratedTerminalShellOptions: [
  266. {
  267. dialect: "git-bash",
  268. id: "git-bash:C:\\Program Files\\Git\\bin\\bash.exe",
  269. label: "Git Bash",
  270. path: "C:\\Program Files\\Git\\bin\\bash.exe",
  271. source: "system",
  272. },
  273. ],
  274. });
  275. expect(markup).toContain("自动选择");
  276. expect(markup).toContain("Git Bash");
  277. expect(markup).toContain(EXPECTED_SHELL_DESCRIPTION_ZH);
  278. expect(zhCN["settings.integratedTerminalShellDescription"]).toBe(EXPECTED_SHELL_DESCRIPTION_ZH);
  279. expect(enUS["settings.integratedTerminalShellDescription"]).toBe(EXPECTED_SHELL_DESCRIPTION_EN);
  280. });
  281. it("增强搜索读取持久值并写回用户切换", async () => {
  282. const onNativeSearchEnhancementsEnabledChange = vi.fn(async () => {});
  283. await renderGeneralSection({
  284. nativeSearchEnhancementsEnabled: false,
  285. onNativeSearchEnhancementsEnabledChange,
  286. });
  287. const nativeSearchSwitch = capturedSwitches.find(
  288. (item) => item["aria-label"] === "增强 Find 和 Grep",
  289. );
  290. expect(nativeSearchSwitch?.checked).toBe(false);
  291. (nativeSearchSwitch?.onCheckedChange as ((checked: boolean) => void) | undefined)?.(true);
  292. expect(onNativeSearchEnhancementsEnabledChange).toHaveBeenCalledWith(true);
  293. });
  294. it("增强 Find 和 Grep 与 Windows Shell 选择位于常规页同一设置组", async () => {
  295. const markup = await renderGeneralSection({
  296. showIntegratedTerminalShell: true,
  297. });
  298. const terminalSettingsGroup = markup
  299. .match(/<section data-settings-group="true">[\s\S]*?<\/section>/g)
  300. ?.find((group) => group.includes(EXPECTED_SHELL_DESCRIPTION_ZH));
  301. expect(terminalSettingsGroup).toContain(EXPECTED_NATIVE_SEARCH_DESCRIPTION_ZH);
  302. });
  303. it("增强搜索提供中英文 Session 生命周期说明", () => {
  304. expect(enUS["settings.nativeSearchEnhancements"]).toBe("Enhanced Find and Grep");
  305. expect(enUS["settings.nativeSearchEnhancementsDescription"]).toBe(
  306. EXPECTED_NATIVE_SEARCH_DESCRIPTION_EN,
  307. );
  308. expect(zhCN["settings.nativeSearchEnhancements"]).toBe("增强 Find 和 Grep");
  309. expect(zhCN["settings.nativeSearchEnhancementsDescription"]).toBe(
  310. EXPECTED_NATIVE_SEARCH_DESCRIPTION_ZH,
  311. );
  312. });
  313. it("记忆模块使用单段中英文说明表达工作区语义、生效边界和用量提示", () => {
  314. expect(enUS["settings.memory"]).toBe("Memory");
  315. expect(enUS["settings.memory.workspaceMemory"]).toBe("Workspace Memory");
  316. expect(enUS["settings.memoryDescription"]).toBe(EXPECTED_MEMORY_DESCRIPTION_EN);
  317. expect(enUS).not.toHaveProperty("settings.memoryUsageNotice");
  318. expect(zhCN["settings.memory"]).toBe("记忆");
  319. expect(zhCN["settings.memory.workspaceMemory"]).toBe("工作区记忆");
  320. expect(zhCN["settings.memoryDescription"]).toBe(EXPECTED_MEMORY_DESCRIPTION_ZH);
  321. expect(zhCN).not.toHaveProperty("settings.memoryUsageNotice");
  322. });
  323. it("桌面端展示 Chrome 硬件加速开关,并把用户选择写回设置", async () => {
  324. const onDesktopChromiumHardwareAccelerationChange = vi.fn(async () => {});
  325. await renderGeneralSection({
  326. onDesktopChromiumHardwareAccelerationChange,
  327. });
  328. const hardwareAccelerationSwitch = capturedSwitches.find(
  329. (item) => item["aria-label"] === "Chrome 硬件加速",
  330. );
  331. expect(hardwareAccelerationSwitch?.checked).toBe(true);
  332. (hardwareAccelerationSwitch?.onCheckedChange as ((checked: boolean) => void) | undefined)?.(
  333. false,
  334. );
  335. expect(onDesktopChromiumHardwareAccelerationChange).toHaveBeenCalledWith(false);
  336. });
  337. it("reasoning 默认开启并把用户操作写回设置回调,同时保持 Todo 默认关闭", async () => {
  338. const onMessageStreamShowReasoningChange = vi.fn(async () => {});
  339. const onMessageStreamShowTodosChange = vi.fn(async () => {});
  340. await renderGeneralSection({
  341. onMessageStreamShowReasoningChange,
  342. onMessageStreamShowTodosChange,
  343. });
  344. const reasoningSwitch = capturedSwitches.find((item) => item["aria-label"] === "显示思考过程");
  345. const todosSwitch = capturedSwitches.find((item) => item["aria-label"] === "显示流式待办");
  346. const performanceModeSwitch = capturedSwitches.find(
  347. (item) => item["aria-label"] === "性能模式",
  348. );
  349. expect(reasoningSwitch?.checked).toBe(true);
  350. expect(todosSwitch?.checked).toBe(false);
  351. expect(performanceModeSwitch).toBeUndefined();
  352. (reasoningSwitch?.onCheckedChange as ((checked: boolean) => void) | undefined)?.(false);
  353. (todosSwitch?.onCheckedChange as ((checked: boolean) => void) | undefined)?.(true);
  354. expect(onMessageStreamShowReasoningChange).toHaveBeenCalledWith(false);
  355. expect(onMessageStreamShowTodosChange).toHaveBeenCalledWith(true);
  356. });
  357. it("工具分组开关使用各自默认值,并把用户操作写回设置回调", async () => {
  358. const onToolGroupingExploreEnabledChange = vi.fn(async () => {});
  359. const onToolGroupingTerminalEnabledChange = vi.fn(async () => {});
  360. const onToolGroupingChangesEnabledChange = vi.fn(async () => {});
  361. await renderGeneralSection({
  362. onToolGroupingExploreEnabledChange,
  363. onToolGroupingTerminalEnabledChange,
  364. onToolGroupingChangesEnabledChange,
  365. });
  366. const exploreSwitch = capturedSwitches.find((item) => item["aria-label"] === "分组探索工具");
  367. const terminalSwitch = capturedSwitches.find((item) => item["aria-label"] === "分组终端命令");
  368. const changesSwitch = capturedSwitches.find((item) => item["aria-label"] === "分组文件更改");
  369. expect(exploreSwitch?.checked).toBe(true);
  370. expect(terminalSwitch?.checked).toBe(true);
  371. expect(changesSwitch?.checked).toBe(false);
  372. (exploreSwitch?.onCheckedChange as ((checked: boolean) => void) | undefined)?.(false);
  373. (terminalSwitch?.onCheckedChange as ((checked: boolean) => void) | undefined)?.(false);
  374. (changesSwitch?.onCheckedChange as ((checked: boolean) => void) | undefined)?.(true);
  375. expect(onToolGroupingExploreEnabledChange).toHaveBeenCalledWith(false);
  376. expect(onToolGroupingTerminalEnabledChange).toHaveBeenCalledWith(false);
  377. expect(onToolGroupingChangesEnabledChange).toHaveBeenCalledWith(true);
  378. });
  379. it("提问自动继续开关读取持久值、写回选择并提供中英文关闭语义", async () => {
  380. const onAskUserQuestionAutoResolutionEnabledChange = vi.fn(async () => {});
  381. const markup = await renderGeneralSection({
  382. askUserQuestionAutoResolutionEnabled: false,
  383. onAskUserQuestionAutoResolutionEnabledChange,
  384. });
  385. const autoResolutionSwitch = capturedSwitches.find(
  386. (item) => item["aria-label"] === "提问自动继续",
  387. );
  388. expect(autoResolutionSwitch?.checked).toBe(false);
  389. expect(markup).toContain(EXPECTED_ASK_AUTO_RESOLUTION_DESCRIPTION_ZH);
  390. expect(zhCN["settings.askUserQuestionAutoResolution"]).toBe("提问自动继续");
  391. expect(zhCN["settings.askUserQuestionAutoResolutionDescription"]).toBe(
  392. EXPECTED_ASK_AUTO_RESOLUTION_DESCRIPTION_ZH,
  393. );
  394. expect(enUS["settings.askUserQuestionAutoResolution"]).toBe("Automatically continue questions");
  395. expect(enUS["settings.askUserQuestionAutoResolutionDescription"]).toBe(
  396. EXPECTED_ASK_AUTO_RESOLUTION_DESCRIPTION_EN,
  397. );
  398. (autoResolutionSwitch?.onCheckedChange as ((checked: boolean) => void) | undefined)?.(true);
  399. expect(onAskUserQuestionAutoResolutionEnabledChange).toHaveBeenCalledWith(true);
  400. });
  401. });