diff options
Diffstat (limited to 'crates/mozart/tests/cli_init.rs')
| -rw-r--r-- | crates/mozart/tests/cli_init.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/mozart/tests/cli_init.rs b/crates/mozart/tests/cli_init.rs new file mode 100644 index 0000000..11661fc --- /dev/null +++ b/crates/mozart/tests/cli_init.rs @@ -0,0 +1,25 @@ +mod common; + +#[test] +fn test_init_creates_composer_json() { + let dir = tempfile::TempDir::new().unwrap(); + common::mozart_cmd() + .arg("init") + .arg("--name") + .arg("test/new-project") + .arg("--no-interaction") + .arg("--working-dir") + .arg(dir.path()) + .assert() + .success(); + + assert!( + dir.path().join("composer.json").exists(), + "composer.json should have been created" + ); + + let content = + std::fs::read_to_string(dir.path().join("composer.json")).expect("Failed to read"); + let json: serde_json::Value = serde_json::from_str(&content).expect("Should be valid JSON"); + assert_eq!(json["name"], serde_json::json!("test/new-project")); +} |
