Files
matcha/tests/cli.rs
chrnx 2f9b656692 fix(add): merge imports into existing brace + capability idempotency; fmt
- wire::add_import now merges a new symbol into an already-present
  `import { ... } from '<from>';` brace instead of appending a second,
  colliding import line for the same module (a duplicate ESM binding
  is a hard SyntaxError/TS2300, not a harmless dupe as previously
  assumed). Falls back to appending a new line when the module isn't
  imported yet, or if the brace-merge edit fails the parses_clean
  guard.
- cmd_add::run gains a capability-level idempotency guard, keyed on
  each capability's unique route-path literal, so `matcha add <cap>`
  run twice no longer appends a duplicate handler + route.
- cargo fmt --all across the crate; drop the stale #[allow(dead_code)]
  on wire::parses_clean now that it's demonstrably live.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-11 13:52:21 -05:00

25 lines
513 B
Rust

use assert_cmd::Command;
use predicates::str::contains;
#[test]
fn help_lists_all_subcommands() {
Command::cargo_bin("matcha")
.unwrap()
.arg("--help")
.assert()
.success()
.stdout(contains("new"))
.stdout(contains("run"))
.stdout(contains("create"))
.stdout(contains("add"));
}
#[test]
fn new_requires_a_name() {
Command::cargo_bin("matcha")
.unwrap()
.arg("new")
.assert()
.failure(); // missing <name>
}