use spinne::ProjectTraverser; use tempfile::TempDir; use std::fs; fn create_mock_project(files: Vec<(&str, &str)>) -> TempDir { let temp_dir = TempDir::new().unwrap(); let root = temp_dir.path(); // Create a nested directory structure fs::create_dir_all(root.join("src/components")).unwrap(); fs::create_dir_all(root.join("src/pages")).unwrap(); // Create mock .tsx files for (path, content) in files { let file_path = root.join(path); fs::write(file_path, content).unwrap(); } // Create non-tsx files fs::write(root.join("README.md"), "# Mock Project").unwrap(); fs::write(root.join("package.json"), "{}").unwrap(); temp_dir } #[test] fn should_resolve_imports_correctly_with_multiple_files() { let temp_dir = create_mock_project(vec![ ("src/components/index.ts", "export { Button } from './Button';"), ("src/components/Button.tsx", "export function Button() { return ; }"), ("src/MyComponent.tsx", "import { Button } from './components'; function MyComponent() { return ; }"), ("src/MyComponent.tsx", "import { Button } from './components'; function MyComponent() { return