use std::path::PathBuf;
use super::capture;
use crate::cli::CliCommand;
use crate::cli::testing::check;
use crate::command::Create;
use crate::error::Error;
#[test]
fn create_maps_to_argv() {
check(vec![
(Create::new("web"), &["create", "web"], None),
(
Create {
starter: Some(PathBuf::from("/starters/api")),
..Create::new("../web")
},
&["create", "../web", "--starter", "/starters/api"],
None,
),
]);
}
#[test]
fn create_returns_the_path_helm_reports() {
let path = Create::new("demo")
.parse(capture("create.stdout"))
.expect("parses");
assert_eq!(path, PathBuf::from("demo"));
assert!(matches!(
Create::new("demo").parse(String::new()),
Err(Error::Parse { .. })
));
}