mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-08 22:21:45 +00:00
Add CLI tests for validate and dry-run on all test workflows
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f6bf30de3e
commit
0edc93e1c3
3 changed files with 108 additions and 0 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -165,6 +165,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"agent",
|
||||
"anyhow",
|
||||
"assert_cmd",
|
||||
"async-trait",
|
||||
"axum",
|
||||
"chrono",
|
||||
|
|
@ -174,6 +175,7 @@ dependencies = [
|
|||
"http-body-util",
|
||||
"llm",
|
||||
"nom",
|
||||
"predicates",
|
||||
"rand",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ tower = "0.5"
|
|||
tokio-stream = { workspace = true, features = ["sync"] }
|
||||
http-body-util = "0.1"
|
||||
dotenvy.workspace = true
|
||||
assert_cmd = "2"
|
||||
predicates = "3"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
|||
104
crates/attractor/tests/cli.rs
Normal file
104
crates/attractor/tests/cli.rs
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
use assert_cmd::Command;
|
||||
use predicates::prelude::*;
|
||||
|
||||
#[allow(deprecated)]
|
||||
fn attractor() -> Command {
|
||||
Command::cargo_bin("attractor").unwrap()
|
||||
}
|
||||
|
||||
// -- validate ----------------------------------------------------------------
|
||||
|
||||
#[test]
|
||||
fn validate_simple() {
|
||||
attractor()
|
||||
.args(["validate", "../../test/simple.dot"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("Validation: OK"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validate_branching() {
|
||||
attractor()
|
||||
.args(["validate", "../../test/branching.dot"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("Validation: OK"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validate_conditions() {
|
||||
attractor()
|
||||
.args(["validate", "../../test/conditions.dot"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("Validation: OK"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validate_parallel() {
|
||||
attractor()
|
||||
.args(["validate", "../../test/parallel.dot"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("Validation: OK"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validate_styled() {
|
||||
attractor()
|
||||
.args(["validate", "../../test/styled.dot"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("Validation: OK"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validate_invalid() {
|
||||
attractor()
|
||||
.args(["validate", "../../test/invalid.dot"])
|
||||
.assert()
|
||||
.failure();
|
||||
}
|
||||
|
||||
// -- run --dry-run -----------------------------------------------------------
|
||||
|
||||
#[test]
|
||||
fn dry_run_simple() {
|
||||
attractor()
|
||||
.args(["run", "--dry-run", "--auto-approve", "../../test/simple.dot"])
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dry_run_branching() {
|
||||
attractor()
|
||||
.args(["run", "--dry-run", "--auto-approve", "../../test/branching.dot"])
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dry_run_conditions() {
|
||||
attractor()
|
||||
.args(["run", "--dry-run", "--auto-approve", "../../test/conditions.dot"])
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dry_run_parallel() {
|
||||
attractor()
|
||||
.args(["run", "--dry-run", "--auto-approve", "../../test/parallel.dot"])
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dry_run_styled() {
|
||||
attractor()
|
||||
.args(["run", "--dry-run", "--auto-approve", "../../test/styled.dot"])
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue