Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
REVIEW: Add unit tests
✗ CI failure Erik Kundt committed 8 months ago
commit 7d28481b8e5a7947eb5f98551e9d61c5e9e50099
parent 3117b773a32d9f7fbe50aa0174bc984cc2c11381
1 failed 1 pending (2 total) View logs
1 file changed +27 -0
modified crates/radicle-cli/src/commands/block/args.rs
@@ -50,3 +50,30 @@ pub struct Args {
    #[arg(value_name = "RID|NID", verbatim_doc_comment)]
    pub(super) target: Target,
}
+

+
#[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", "z6MkiswaKJ85vafhffCGBu2gdBsYoDAyHVBWRxL3j297fwS9"]);
+
        assert!(args.is_ok())
+
    }
+

+
    #[test]
+
    fn should_parse_rid() {
+
        let args = Args::try_parse_from(["block", "rad:z3Tr6bC7ctEg2EHmLvknUr29mEDLH"]);
+
        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);
+
    }
+
}