mod common;
use common::Fixture;
#[test]
fn nxm_handle_requires_uri() {
let fx = Fixture::new();
let output = fx
.cmd()
.args(["nxm", "handle"])
.output()
.expect("spawn modde");
assert!(
!output.status.success(),
"modde nxm handle without a URI must fail"
);
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
stderr.contains("<URI>") || stderr.contains("required"),
"stderr should mention the missing URI; got:\n{stderr}"
);
}
#[test]
fn nxm_handle_rejects_non_nxm_scheme() {
let fx = Fixture::new();
let output = fx
.cmd()
.args(["nxm", "handle", "https://nexusmods.com/skyrim/mods/1"])
.output()
.expect("spawn modde");
assert!(!output.status.success(), "non-nxm scheme must be rejected");
}
#[test]
fn nxm_handle_rejects_malformed_path() {
let fx = Fixture::new();
let output = fx
.cmd()
.args(["nxm", "handle", "nxm://skyrim/garbage/path"])
.output()
.expect("spawn modde");
assert!(
!output.status.success(),
"malformed nxm:// URI must be rejected"
);
}
#[test]
fn nxm_handle_rejects_non_numeric_ids() {
let fx = Fixture::new();
let output = fx
.cmd()
.args(["nxm", "handle", "nxm://skyrim/mods/abc/files/def"])
.output()
.expect("spawn modde");
assert!(
!output.status.success(),
"non-numeric mod_id/file_id must be rejected"
);
}