Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
REVIEW: Add unit tests
◌ CI pending Erik Kundt committed 7 months ago
commit 01f9bad81fe2443cac13db63cfdd8792114b4651
parent cb8e011b1342bb7e325b58c3565860ae485bed87
1 pending (1 total) View logs
1 file changed +27 -0
modified crates/radicle-cli/src/commands/block.rs
@@ -22,3 +22,30 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
    }
    Ok(())
}
+

+
#[cfg(test)]
+
mod test {
+
    use clap::error::ErrorKind;
+
    use clap::Parser;
+

+
    use super::Args;
+

+
    #[test]
+
    fn should_parse_nid() {
+
        let args =
+
            Args::try_parse_from(["block", "z6MksmpU5b1dS7oaqF2bHXhQi1DWy2hB7Mh9CuN7y1DN6QSz"]);
+
        assert!(args.is_ok())
+
    }
+

+
    #[test]
+
    fn should_parse_rid() {
+
        let args = Args::try_parse_from(["block", "rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5"]);
+
        assert!(args.is_ok())
+
    }
+

+
    #[test]
+
    fn should_not_parse() {
+
        let err = Args::try_parse_from(["block", "bee"]).unwrap_err();
+
        assert_eq!(err.kind(), ErrorKind::ValueValidation);
+
    }
+
}