From: Ikeh Celestine Chukwudi Date: Fri, 9 Oct 2026 20:34:09 +0000 (+0100) Subject: test(compile): cover sh and sh-wsh script types X-Git-Url: http://internal-gitweb-vhost/-client-interface/%22https:/src/struct.EncoderStringWriter.html?a=commitdiff_plain;h=79b2b8377bd0977d3f806ce1b82e3e88f0424f88;p=bdk-cli test(compile): cover sh and sh-wsh script types The existing compile tests only exercise wsh and tr. Add a test for the sh and sh-wsh branches so every ScriptType variant is covered. --- diff --git a/tests/integration/init.rs b/tests/integration/init.rs index 5244d99..120341a 100644 --- a/tests/integration/init.rs +++ b/tests/integration/init.rs @@ -223,6 +223,26 @@ mod test_compile { .stdout(predicate::str::contains("wsh(")); } + #[test] + fn test_compile_sh_and_sh_wsh() { + let temp_dir = TempDir::new().unwrap(); + let cli = BdkCli::new("testnet", Some(temp_dir.path().to_path_buf())); + + let policy = "pk(02e5b88fdb71c696e1a473f309a47535b7190e21a22bd25e7fc8bd055db3bba12f)"; + + // compile sh + cli.cmd("compile", &[policy, "--type", "sh"]) + .assert() + .success() + .stdout(predicate::str::contains("\"descriptor\": \"sh(pk(")); + + // compile sh-wsh + cli.cmd("compile", &[policy, "--type", "sh-wsh"]) + .assert() + .success() + .stdout(predicate::str::contains("\"descriptor\": \"sh(wsh(pk(")); + } + #[test] fn test_compile_invalid_policy() { let temp_dir = TempDir::new().unwrap();