From 08727528aa25b97755fd7701fb56b535404ff236 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 20 Apr 2026 12:19:08 +0800 Subject: [PATCH] test: sync stale fixtures and isolate openclaw env tests Three unrelated test failures surfaced after rebase: - McpFormModal expected the apps boolean set without `hermes`; Hermes MCP support is now wired, so the fixture must include `hermes: false`. - therouter Gemini preset was bumped to `gemini-3.1-pro` in a later commit; update the assertions to match current config. - openclaw_config tests mutate process-level `CC_SWITCH_TEST_HOME` and `HOME` inside a module-local Mutex, but hermes_config does the same under its own separate Mutex. Running both modules in parallel let the env races corrupt hermes_config's `with_test_home`. Tag the four env-mutating openclaw tests with `#[serial]` so they serialize across modules via serial_test's process-wide default key. --- src-tauri/src/openclaw_config.rs | 5 +++++ tests/components/McpFormModal.test.tsx | 1 + tests/config/therouterProviderPresets.test.ts | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/openclaw_config.rs b/src-tauri/src/openclaw_config.rs index 54ef078ce..976fcd1e5 100644 --- a/src-tauri/src/openclaw_config.rs +++ b/src-tauri/src/openclaw_config.rs @@ -914,6 +914,7 @@ pub fn set_tools_config(tools: &OpenClawToolsConfig) -> Result std::sync::MutexGuard<'static, ()> { @@ -966,6 +967,7 @@ mod tests { } #[test] + #[serial] fn default_model_write_preserves_top_level_comments() { let source = r#"{ // top-level comment @@ -994,6 +996,7 @@ mod tests { } #[test] + #[serial] fn default_model_noop_write_skips_backup() { let source = r#"{ models: { @@ -1028,6 +1031,7 @@ mod tests { } #[test] + #[serial] fn save_detects_external_conflict() { let source = r#"{ models: { @@ -1050,6 +1054,7 @@ mod tests { } #[test] + #[serial] fn remove_last_provider_writes_empty_providers_without_panic() { let source = r#"{ models: { diff --git a/tests/components/McpFormModal.test.tsx b/tests/components/McpFormModal.test.tsx index 8816ceaf9..535b99557 100644 --- a/tests/components/McpFormModal.test.tsx +++ b/tests/components/McpFormModal.test.tsx @@ -434,6 +434,7 @@ type = "stdio" gemini: false, opencode: false, openclaw: false, + hermes: false, }); expect(onSave).toHaveBeenCalledTimes(1); expect(toastErrorMock).not.toHaveBeenCalled(); diff --git a/tests/config/therouterProviderPresets.test.ts b/tests/config/therouterProviderPresets.test.ts index 4c00e1798..77a180e13 100644 --- a/tests/config/therouterProviderPresets.test.ts +++ b/tests/config/therouterProviderPresets.test.ts @@ -57,10 +57,10 @@ describe("TheRouter provider presets", () => { expect(preset?.category).toBe("aggregator"); expect(preset?.endpointCandidates).toEqual(["https://api.therouter.ai"]); expect(preset?.baseURL).toBe("https://api.therouter.ai"); - expect(preset?.model).toBe("gemini-2.5-pro"); + expect(preset?.model).toBe("gemini-3.1-pro"); const env = (preset?.settingsConfig as { env: Record }).env; expect(env.GOOGLE_GEMINI_BASE_URL).toBe("https://api.therouter.ai"); - expect(env.GEMINI_MODEL).toBe("gemini-2.5-pro"); + expect(env.GEMINI_MODEL).toBe("gemini-3.1-pro"); }); });