aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/tests/cli_licenses.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/mozart/tests/cli_licenses.rs')
-rw-r--r--crates/mozart/tests/cli_licenses.rs50
1 files changed, 50 insertions, 0 deletions
diff --git a/crates/mozart/tests/cli_licenses.rs b/crates/mozart/tests/cli_licenses.rs
new file mode 100644
index 0000000..96d5c4e
--- /dev/null
+++ b/crates/mozart/tests/cli_licenses.rs
@@ -0,0 +1,50 @@
+mod common;
+
+use predicates::str::contains;
+
+#[test]
+fn test_licenses_locked() {
+ let project = common::copy_fixture_to_temp("with_lock");
+ common::mozart_cmd()
+ .arg("licenses")
+ .arg("--locked")
+ .arg("--working-dir")
+ .arg(project.path())
+ .assert()
+ .success()
+ .stdout(contains("MIT"));
+}
+
+#[test]
+fn test_licenses_format_json() {
+ let project = common::copy_fixture_to_temp("with_lock");
+ let output = common::mozart_cmd()
+ .arg("licenses")
+ .arg("--format=json")
+ .arg("--locked")
+ .arg("--working-dir")
+ .arg(project.path())
+ .assert()
+ .success()
+ .get_output()
+ .stdout
+ .clone();
+
+ let stdout = String::from_utf8_lossy(&output);
+ serde_json::from_str::<serde_json::Value>(&stdout)
+ .expect("licenses --format=json output should be valid JSON");
+}
+
+#[test]
+fn test_licenses_format_summary() {
+ let project = common::copy_fixture_to_temp("with_lock");
+ common::mozart_cmd()
+ .arg("licenses")
+ .arg("--format=summary")
+ .arg("--locked")
+ .arg("--working-dir")
+ .arg(project.path())
+ .assert()
+ .success()
+ .stdout(contains("MIT"));
+}