chore: fix code formatting and test setup

- Format Rust code with rustfmt (misc.rs, types.rs)
- Format TypeScript/React code with Prettier (4 files)
- Fix ProviderList test by wrapping with QueryClientProvider
This commit is contained in:
Jason
2026-01-20 23:40:33 +08:00
parent 00168877d9
commit b993b1f664
7 changed files with 66 additions and 25 deletions

View File

@@ -605,8 +605,7 @@ exec bash --norc --noprofile
script_file = script_file.display()
);
std::fs::write(&script_file, &script_content)
.map_err(|e| format!("写入启动脚本失败: {e}"))?;
std::fs::write(&script_file, &script_content).map_err(|e| format!("写入启动脚本失败: {e}"))?;
// Make script executable
std::fs::set_permissions(&script_file, std::fs::Permissions::from_mode(0o755))
@@ -675,8 +674,7 @@ exec bash --norc --noprofile
script_file = script_file.display()
);
std::fs::write(&script_file, &script_content)
.map_err(|e| format!("写入启动脚本失败: {e}"))?;
std::fs::write(&script_file, &script_content).map_err(|e| format!("写入启动脚本失败: {e}"))?;
std::fs::set_permissions(&script_file, std::fs::Permissions::from_mode(0o755))
.map_err(|e| format!("设置脚本权限失败: {e}"))?;

View File

@@ -316,30 +316,48 @@ mod tests {
#[test]
fn test_log_config_to_level_filter() {
let mut config = LogConfig::default();
config.level = "error".to_string();
let config = LogConfig {
level: "error".to_string(),
..Default::default()
};
assert_eq!(config.to_level_filter(), log::LevelFilter::Error);
config.level = "warn".to_string();
let config = LogConfig {
level: "warn".to_string(),
..Default::default()
};
assert_eq!(config.to_level_filter(), log::LevelFilter::Warn);
config.level = "info".to_string();
let config = LogConfig {
level: "info".to_string(),
..Default::default()
};
assert_eq!(config.to_level_filter(), log::LevelFilter::Info);
config.level = "debug".to_string();
let config = LogConfig {
level: "debug".to_string(),
..Default::default()
};
assert_eq!(config.to_level_filter(), log::LevelFilter::Debug);
config.level = "trace".to_string();
let config = LogConfig {
level: "trace".to_string(),
..Default::default()
};
assert_eq!(config.to_level_filter(), log::LevelFilter::Trace);
// 无效级别回退到 info
config.level = "invalid".to_string();
let config = LogConfig {
level: "invalid".to_string(),
..Default::default()
};
assert_eq!(config.to_level_filter(), log::LevelFilter::Info);
// 禁用时返回 Off
config.enabled = false;
config.level = "debug".to_string();
let config = LogConfig {
enabled: false,
level: "debug".to_string(),
};
assert_eq!(config.to_level_filter(), log::LevelFilter::Off);
}