Files
matcha/tests/new.rs
T
2026-07-11 12:59:38 -05:00

23 lines
659 B
Rust

use assert_cmd::Command;
use tempfile::tempdir;
#[test]
fn new_scaffolds_into_named_dir() {
let d = tempdir().unwrap();
Command::cargo_bin("matcha").unwrap()
.current_dir(d.path())
.args(["new", "my-api"]).assert().success();
let root = d.path().join("my-api");
assert!(root.join("src/app.module.ts").exists());
assert!(root.join("public/index.html").exists());
}
#[test]
fn new_refuses_existing_dir() {
let d = tempdir().unwrap();
std::fs::create_dir(d.path().join("taken")).unwrap();
Command::cargo_bin("matcha").unwrap()
.current_dir(d.path())
.args(["new", "taken"]).assert().failure();
}