/ cli_commands_unit_test.rs
cli_commands_unit_test.rs
1 use ferris_proof_cli::commands::init; 2 use ferris_proof_core::models::config::VerificationLevel; 3 use std::fs; 4 use tempfile::tempdir; 5 6 #[tokio::test] 7 async fn test_init_command_creates_files() { 8 let dir = tempdir().unwrap(); 9 let project_path = dir.path(); 10 11 // Change current directory to the temporary one 12 std::env::set_current_dir(project_path).unwrap(); 13 14 let result = init::run(VerificationLevel::Standard, false, None).await; 15 assert!(result.is_ok()); 16 17 // Verify that the expected files and directories were created 18 assert!(project_path.join("ferrisproof.toml").exists()); 19 assert!(project_path.join("specs").is_dir()); 20 assert!(project_path.join("tests").is_dir()); 21 assert!(project_path.join("tests/property").is_dir()); 22 23 // Verify content of ferrisproof.toml 24 let content = fs::read_to_string(project_path.join("ferrisproof.toml")).unwrap(); 25 assert!(content.contains("level = \"standard\"")); 26 27 dir.close().unwrap(); 28 }