From afabe80167743b1acba51d7036588d62d872c7cb Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 7 Jul 2026 11:57:26 +0800 Subject: [PATCH] test(profiles): gate desktop-scope assertion by platform in profile roundtrip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The desktop switch to d2 is cfg-gated to macOS/Windows, but the assertion expecting d2 was not, so on Linux CI the desktop provider stays at the seeded d1 and the assertion panics — poisoning the shared test mutex and cascading into two more failures. Expect d1 on non-desktop platforms. --- src-tauri/tests/profile_roundtrip.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src-tauri/tests/profile_roundtrip.rs b/src-tauri/tests/profile_roundtrip.rs index bc0931ce1..1f85f4987 100644 --- a/src-tauri/tests/profile_roundtrip.rs +++ b/src-tauri/tests/profile_roundtrip.rs @@ -218,15 +218,21 @@ fn profile_snapshot_apply_roundtrip_restores_configuration() { .expect("get current provider"); assert_eq!(current.as_deref(), Some("p1"), "provider restored to p1"); - // Claude 分组不再管理 Desktop:Desktop 保持 d2 不变 + // Claude 分组不再管理 Desktop:apply 后 Desktop 保持切换前的状态不变。 + // macOS/Windows 上上面已切到 d2;Linux(CI)不支持 Desktop 切换、那行被 cfg 门控 + // 编译剔除,Desktop 仍是种子值 d1。两种情况都验证 claude-scope apply 不会动 Desktop。 let current_desktop = state .db .get_current_provider(AppType::ClaudeDesktop.as_str()) .expect("get current desktop provider"); + #[cfg(any(target_os = "macos", windows))] + let expected_desktop = "d2"; + #[cfg(not(any(target_os = "macos", windows)))] + let expected_desktop = "d1"; assert_eq!( current_desktop.as_deref(), - Some("d2"), - "desktop provider stays at d2 after claude-scope apply" + Some(expected_desktop), + "desktop provider untouched by claude-scope apply" ); let servers = state.db.get_all_mcp_servers().expect("get mcp servers");