tmuxido/tests/cache_lifecycle.rs
cinco euzebio 9198c481c0 test: add integration tests for scan, session config and cache lifecycle
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>
2026-02-28 20:16:09 -03:00

14 lines
402 B
Rust

use std::collections::HashMap;
use std::path::PathBuf;
use tmuxido::cache::ProjectCache;
#[test]
fn should_save_and_reload_cache() {
let projects = vec![PathBuf::from("/tmp/test_tmuxido_project")];
let cache = ProjectCache::new(projects.clone(), HashMap::new());
cache.save().unwrap();
let loaded = ProjectCache::load().unwrap().unwrap();
assert_eq!(loaded.projects, projects);
}