//! Configuration merging tests use anyhow::Result; use std::fs; #[test] fn test_toml_config_merging() -> Result<()> { let temp_project = crate::create_test_project()?; let project_root = temp_project.path(); // Create base config let base_config = r#" [app] name = "test-app" version = "1.0.0" [database] host = "localhost" port = 5432 "#; let config_path = project_root.join("config.toml"); fs::write(&config_path, base_config)?; // Create feature config to merge let feature_config = r#" [database] ssl = true pool_size = 10 [analytics] enabled = true endpoint = "http://analytics.example.com" "#; // Test merging (would use ConfigurationIntegrator) // Expected result should have both sections merged Ok(()) } #[test] fn test_json_config_merging() -> Result<()> { let temp_project = crate::create_test_project()?; let project_root = temp_project.path(); // Test JSON configuration merging let base_json = r#"{ "app": { "name": "test-app", "features": ["basic"] } }"#; let feature_json = r#"{ "app": { "features": ["analytics"], "analytics": { "enabled": true } } }"#; // Test merging logic // Expected: features should be merged into ["basic", "analytics"] Ok(()) } #[test] fn test_env_variable_integration() -> Result<()> { let temp_project = crate::create_test_project()?; let project_root = temp_project.path(); // Test .env file integration let initial_env = "APP_NAME=test-app\nDEBUG=true\n"; let env_path = project_root.join(".env"); fs::write(&env_path, initial_env)?; // Simulate adding feature environment variables // This would use EnvironmentIntegrator // Verify no duplicates and proper formatting let final_content = fs::read_to_string(&env_path)?; assert!(final_content.contains("APP_NAME=test-app")); assert!(final_content.contains("DEBUG=true")); Ok(()) }