#[cfg(test)]
mod tests {
    use assert_cmd::prelude::*; // Add methods on commands
    use predicates::prelude::*; // Used for writing assertions
    use std::{env, process::Command}; // Run programs

    fn get_path() -> std::path::PathBuf {
        std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
            .join("tests")
            .join("tests_makefile")
    }

    #[test]
    fn test_main_base_analyze() {
        // create the json first
        let mut cmd_run = Command::cargo_bin("meka").unwrap();
        cmd_run.current_dir(get_path());
        cmd_run.arg("run");
        cmd_run.arg("-dd");
        cmd_run.arg("make");

        let mut cmd = Command::cargo_bin("meka").unwrap();
        cmd.current_dir(get_path());
        cmd.arg("analyze");

        cmd.assert()
            .success()
            .stdout(predicate::str::contains("- ls folder"))
            .stdout(predicate::str::contains("- date"))
            .stdout(predicate::str::contains("- sleep 1"))
            .stdout(predicate::str::contains("- ls folder"));
    }
}
