test(profiles): gate desktop-scope assertion by platform in profile roundtrip

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.
This commit is contained in:
Jason
2026-07-07 11:57:26 +08:00
parent 7fada72dd4
commit afabe80167
+9 -3
View File
@@ -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 分组不再管理 DesktopDesktop 保持 d2 不变
// Claude 分组不再管理 Desktopapply 后 Desktop 保持切换前的状态不变
// macOS/Windows 上上面已切到 d2LinuxCI)不支持 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");