cli/tests: Refactor jj command tests
This commit is contained in:
parent
4753b889dc
commit
b2568f0b47
|
|
@ -3,7 +3,6 @@ use std::path::Path;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::{fs, net, thread, time};
|
use std::{fs, net, thread, time};
|
||||||
|
|
||||||
use radicle::git;
|
|
||||||
use radicle::node;
|
use radicle::node;
|
||||||
use radicle::node::address::Store as _;
|
use radicle::node::address::Store as _;
|
||||||
use radicle::node::config::seeds::RADICLE_NODE_BOOTSTRAP_IRIS;
|
use radicle::node::config::seeds::RADICLE_NODE_BOOTSTRAP_IRIS;
|
||||||
|
|
@ -37,6 +36,7 @@ mod commands {
|
||||||
mod inbox;
|
mod inbox;
|
||||||
mod init;
|
mod init;
|
||||||
mod issue;
|
mod issue;
|
||||||
|
mod jj;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run a CLI test file.
|
/// Run a CLI test file.
|
||||||
|
|
@ -275,48 +275,6 @@ fn rad_patch() {
|
||||||
Environment::alice(["rad-init", "rad-patch"]);
|
Environment::alice(["rad-init", "rad-patch"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn rad_jj_bare() {
|
|
||||||
// We test whether `jj` is installed, and have this test succeed if it is not.
|
|
||||||
// Programmatic skipping of tests is not supported as of 2024-08.
|
|
||||||
if !program_reports_version("jj") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut environment = Environment::new();
|
|
||||||
let mut profile = environment.node("alice");
|
|
||||||
let rid = profile.project("heartwood", "Radicle Heartwood Protocol & Stack");
|
|
||||||
|
|
||||||
test(
|
|
||||||
"examples/rad-init-existing-bare.md",
|
|
||||||
environment.work(&profile),
|
|
||||||
Some(&profile.home),
|
|
||||||
[(
|
|
||||||
"URL",
|
|
||||||
git::url::File::new(profile.storage.path())
|
|
||||||
.rid(rid)
|
|
||||||
.to_string()
|
|
||||||
.as_str(),
|
|
||||||
)],
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
environment
|
|
||||||
.tests(["jj-config", "jj-init-bare"], &profile)
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn rad_jj_colocated_patch() {
|
|
||||||
// We test whether `jj` is installed, and have this test succeed if it is not.
|
|
||||||
// Programmatic skipping of tests is not supported as of 2024-08.
|
|
||||||
if !program_reports_version("jj") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Environment::alice(["rad-init", "jj-config", "jj-init-colocate", "rad-patch-jj"])
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn rad_patch_diff() {
|
fn rad_patch_diff() {
|
||||||
Environment::alice(["rad-init", "rad-patch-diff"]);
|
Environment::alice(["rad-init", "rad-patch-diff"]);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
use crate::util::environment::Environment;
|
||||||
|
use crate::{program_reports_version, test};
|
||||||
|
use radicle::git;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rad_jj_bare() {
|
||||||
|
// We test whether `jj` is installed, and have this test succeed if it is not.
|
||||||
|
// Programmatic skipping of tests is not supported as of 2024-08.
|
||||||
|
if !program_reports_version("jj") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut environment = Environment::new();
|
||||||
|
let mut profile = environment.node("alice");
|
||||||
|
let rid = profile.project("heartwood", "Radicle Heartwood Protocol & Stack");
|
||||||
|
|
||||||
|
test(
|
||||||
|
"examples/rad-init-existing-bare.md",
|
||||||
|
environment.work(&profile),
|
||||||
|
Some(&profile.home),
|
||||||
|
[(
|
||||||
|
"URL",
|
||||||
|
git::url::File::new(profile.storage.path())
|
||||||
|
.rid(rid)
|
||||||
|
.to_string()
|
||||||
|
.as_str(),
|
||||||
|
)],
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
environment
|
||||||
|
.tests(["jj-config", "jj-init-bare"], &profile)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rad_jj_colocated_patch() {
|
||||||
|
// We test whether `jj` is installed, and have this test succeed if it is not.
|
||||||
|
// Programmatic skipping of tests is not supported as of 2024-08.
|
||||||
|
if !program_reports_version("jj") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Environment::alice(["rad-init", "jj-config", "jj-init-colocate", "rad-patch-jj"])
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue