tests/scan.rs: 3 tests exercising scan_from_root via the public API — finds git repos, skips hidden directories, and respects max_depth. Note: tempfile::tempdir() generates hidden paths (.tmpXXXXXX) on this system, so each test creates a visible scan_root/ subdirectory to avoid filter_entry silently skipping the walk root. tests/session_config.rs: 2 tests for SessionConfig::load_from_project — loads a .tmuxido.toml written into a temp dir and returns None when the file is absent. tests/cache_lifecycle.rs: round-trip test that saves a ProjectCache and reloads it, verifying the projects list survives serialisation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
727 B
Rust
27 lines
727 B
Rust
use std::fs;
|
|
use tempfile::tempdir;
|
|
use tmuxido::session::SessionConfig;
|
|
|
|
#[test]
|
|
fn should_load_project_session_config() {
|
|
let dir = tempdir().unwrap();
|
|
let config_content = r#"
|
|
[[windows]]
|
|
name = "editor"
|
|
panes = ["nvim ."]
|
|
"#;
|
|
fs::write(dir.path().join(".tmuxido.toml"), config_content).unwrap();
|
|
|
|
let result = SessionConfig::load_from_project(dir.path()).unwrap();
|
|
assert!(result.is_some());
|
|
let config = result.unwrap();
|
|
assert_eq!(config.windows[0].name, "editor");
|
|
}
|
|
|
|
#[test]
|
|
fn should_return_none_when_no_project_config() {
|
|
let dir = tempdir().unwrap();
|
|
let result = SessionConfig::load_from_project(dir.path()).unwrap();
|
|
assert!(result.is_none());
|
|
}
|