Skip to content

Commit

Permalink
Test commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Limeth committed Aug 4, 2024
1 parent 8ad76b1 commit a0d0ada
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ derive_more = "0.99.17"
ed25519-dalek = { version = "2.1.1", features = ["rand_core", "pem"] }
futures = "0.3.30"
include_dir = { version = "0.7.4", features = ["nightly"] }
rrr = { git = "https://github.com/recursive-record-registry/rrr.git", rev = "f2dfeeba77a386d05a7182584a32c508aa831567" }
rrr = { git = "https://github.com/recursive-record-registry/rrr.git", rev = "8c1a37007cbded8c144b6ff566656b104a7d0add" }
serde = { version = "1.0.203", features = ["derive"] }
serde_bytes = "0.11.14"
serde_with = "3.8.1"
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub enum Command {

impl Command {
pub async fn process(self) -> Result<()> {
match Command::parse() {
match self {
Command::New { directory, force } => {
OwnedRegistry::generate(&directory, force).await.unwrap();
println!("New registry successfully generated in {directory:?}.");
Expand Down
24 changes: 24 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,27 @@ async fn owned_registry() {
.successive_records
.is_empty());
}

#[cfg(feature = "cmd")]
#[tokio::test]
#[traced_test]
async fn new_registry() {
use rrr_make::cmd::Command;

let registry_dir = tempdir().unwrap();
Command::New {
directory: registry_dir.path().into(),
force: false,
}
.process()
.await
.unwrap();
Command::Make {
input_directory: registry_dir.path().into(),
publish: false,
force: false,
}
.process()
.await
.unwrap();
}

0 comments on commit a0d0ada

Please sign in to comment.