diff options
| author | sneurlax <sneurlax@gmail.com> | 2024-10-18 19:27:57 -0500 |
|---|---|---|
| committer | sneurlax <sneurlax@gmail.com> | 2024-10-18 19:28:00 -0500 |
| commit | 0bd5ae9dee986fa3580c6a2bb7db1b2285d8aadf (patch) | |
| tree | c97d265450c24bca8843bd0f7dab5b21f1b08521 /impls/monero.rs/tests | |
| parent | 39ff3023565a7040e211f3f2673260b644c01080 (diff) | |
add get_height
Diffstat (limited to 'impls/monero.rs/tests')
| -rw-r--r-- | impls/monero.rs/tests/integration_tests.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/impls/monero.rs/tests/integration_tests.rs b/impls/monero.rs/tests/integration_tests.rs index 0310d4d..da7a6c6 100644 --- a/impls/monero.rs/tests/integration_tests.rs +++ b/impls/monero.rs/tests/integration_tests.rs @@ -474,3 +474,37 @@ fn test_close_wallet_integration() { // Clean up. teardown(&temp_dir).expect("Failed to clean up after test"); } + +#[test] +fn test_get_height_integration() { + println!("Running test_get_height_integration"); + let (manager, temp_dir) = setup().expect("Failed to set up test environment"); + + // Construct the full path for the wallet within temp_dir. + let wallet_path = temp_dir.path().join("test_wallet_height"); + let wallet_str = wallet_path.to_str().expect("Failed to convert wallet path to string"); + + // Create the wallet. + let wallet = manager + .create_wallet(wallet_str, "password", "English", NetworkType::Mainnet) + .expect("Failed to create wallet"); + + // Fetch the blockchain height. + println!("Fetching blockchain height..."); + let start = Instant::now(); + let height_result = manager.get_height(); + let duration = start.elapsed(); + println!("Blockchain height retrieval took {:?}", duration); + + assert!( + height_result.is_ok(), + "Failed to fetch blockchain height: {:?}", + height_result.err() + ); + + let height = height_result.unwrap(); + println!("Current blockchain height: {}", height); + assert!(height == 0, "Blockchain height should be equal to 0."); + + teardown(&temp_dir).expect("Failed to clean up after test"); +} |
