Test refactor
- Fix esplora module level feature flag - Move esplora blockchain tests to module, to cover for both variants (cherry picked from commit 8d1d92e71e61f7c8094b3f3c8ed26b849cc8250b)
This commit is contained in:
		
							parent
							
								
									7cb0116c44
								
							
						
					
					
						commit
						84b8579df5
					
				| @ -29,38 +29,16 @@ use bitcoin::{BlockHash, Txid}; | ||||
| use crate::error::Error; | ||||
| use crate::FeeRate; | ||||
| 
 | ||||
| #[cfg(all(
 | ||||
|     feature = "esplora", | ||||
|     feature = "reqwest", | ||||
|     any(feature = "async-interface", target_arch = "wasm32"), | ||||
| ))] | ||||
| #[cfg(feature = "reqwest")] | ||||
| mod reqwest; | ||||
| 
 | ||||
| #[cfg(all(
 | ||||
|     feature = "esplora", | ||||
|     feature = "reqwest", | ||||
|     any(feature = "async-interface", target_arch = "wasm32"), | ||||
| ))] | ||||
| #[cfg(feature = "reqwest")] | ||||
| pub use self::reqwest::*; | ||||
| 
 | ||||
| #[cfg(all(
 | ||||
|     feature = "esplora", | ||||
|     not(any( | ||||
|         feature = "async-interface", | ||||
|         feature = "reqwest", | ||||
|         target_arch = "wasm32" | ||||
|     )), | ||||
| ))] | ||||
| #[cfg(feature = "ureq")] | ||||
| mod ureq; | ||||
| 
 | ||||
| #[cfg(all(
 | ||||
|     feature = "esplora", | ||||
|     not(any( | ||||
|         feature = "async-interface", | ||||
|         feature = "reqwest", | ||||
|         target_arch = "wasm32" | ||||
|     )), | ||||
| ))] | ||||
| #[cfg(feature = "ureq")] | ||||
| pub use self::ureq::*; | ||||
| 
 | ||||
| fn into_fee_rate(target: usize, estimates: HashMap<String, f64>) -> Result<FeeRate, Error> { | ||||
| @ -141,3 +119,11 @@ impl_error!(io::Error, Io, EsploraError); | ||||
| impl_error!(std::num::ParseIntError, Parsing, EsploraError); | ||||
| impl_error!(consensus::encode::Error, BitcoinEncoding, EsploraError); | ||||
| impl_error!(bitcoin::hashes::hex::Error, Hex, EsploraError); | ||||
| 
 | ||||
| #[cfg(test)] | ||||
| #[cfg(feature = "test-esplora")] | ||||
| crate::bdk_blockchain_tests! { | ||||
|     fn test_instance(test_client: &TestClient) -> EsploraBlockchain { | ||||
|         EsploraBlockchain::new(&format!("http://{}",test_client.electrsd.esplora_url.as_ref().unwrap()), 20) | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -350,11 +350,3 @@ impl ConfigurableBlockchain for EsploraBlockchain { | ||||
|         Ok(blockchain) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| #[cfg(test)] | ||||
| #[cfg(feature = "test-esplora")] | ||||
| crate::bdk_blockchain_tests! { | ||||
|     fn test_instance(test_client: &TestClient) -> EsploraBlockchain { | ||||
|         EsploraBlockchain::new(&format!("http://{}",test_client.electrsd.esplora_url.as_ref().unwrap()), None, 20) | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user