mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-05-06 22:01:44 +08:00
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.
This commit is contained in:
@@ -914,6 +914,7 @@ pub fn set_tools_config(tools: &OpenClawToolsConfig) -> Result<OpenClawWriteOutc
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use serial_test::serial;
|
||||
use std::sync::{Mutex, OnceLock};
|
||||
|
||||
fn test_guard() -> 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: {
|
||||
|
||||
@@ -434,6 +434,7 @@ type = "stdio"
|
||||
gemini: false,
|
||||
opencode: false,
|
||||
openclaw: false,
|
||||
hermes: false,
|
||||
});
|
||||
expect(onSave).toHaveBeenCalledTimes(1);
|
||||
expect(toastErrorMock).not.toHaveBeenCalled();
|
||||
|
||||
@@ -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<string, string> }).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");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user