ggen-cli-lib 26.7.3

CLI interface for ggen
Documentation
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::needless_raw_string_hashes, clippy::duration_suboptimal_units, clippy::branches_sharing_code, clippy::used_underscore_binding, clippy::single_char_pattern, clippy::ignore_without_reason, clippy::cloned_ref_to_slice_refs, clippy::doc_overindented_list_items, clippy::match_wildcard_for_single_variants, clippy::ignored_unit_patterns, clippy::needless_collect, clippy::unnecessary_map_or, clippy::manual_flatten, clippy::manual_strip, clippy::future_not_send, clippy::unnested_or_patterns, clippy::no_effect_underscore_binding, clippy::literal_string_with_formatting_args)]
use ggen_cli_lib::domain::project::*;
use std::path::PathBuf;
use tempfile::TempDir;

#[tokio::test]
async fn test_init_project_success() {
    let temp_dir = TempDir::new().unwrap();
    let project_path = temp_dir.path().join("test_project");

    let result = init_project(&project_path, "test_project").await;
    assert!(result.is_ok());
    assert!(project_path.exists());
    assert!(project_path.join("src").exists());
    assert!(project_path.join("tests").exists());
}

#[tokio::test]
async fn test_init_project_empty_name() {
    let temp_dir = TempDir::new().unwrap();
    let result = init_project(temp_dir.path(), "").await;
    assert!(result.is_err());
}

#[test]
fn test_is_project() {
    let temp_dir = TempDir::new().unwrap();
    assert!(is_project(temp_dir.path()));
    assert!(!is_project(std::path::Path::new("/nonexistent")));
}