feat: nutshell itests (#691)

This commit is contained in:
thesimplekid
2025-03-29 22:04:43 +00:00
committed by GitHub
parent 240e22c96a
commit 52bfc8c9ce
14 changed files with 865 additions and 737 deletions

View File

@@ -1,3 +1,4 @@
use std::env;
use std::sync::Arc;
use anyhow::{anyhow, bail, Result};
@@ -5,6 +6,7 @@ use cdk::amount::{Amount, SplitTarget};
use cdk::nuts::{MintQuoteState, NotificationPayload, State};
use cdk::wallet::WalletSubscription;
use cdk::Wallet;
use init_regtest::get_mint_url;
use tokio::time::{sleep, timeout, Duration};
pub mod init_auth_mint;
@@ -119,3 +121,27 @@ pub async fn wait_for_mint_to_be_paid(
}
}
}
/// Gets the mint URL from environment variable or falls back to default
///
/// Checks the CDK_TEST_MINT_URL environment variable:
/// - If set, returns that URL
/// - Otherwise falls back to the default URL from get_mint_url("0")
pub fn get_mint_url_from_env() -> String {
match env::var("CDK_TEST_MINT_URL") {
Ok(url) => url,
Err(_) => get_mint_url("0"),
}
}
/// Gets the second mint URL from environment variable or falls back to default
///
/// Checks the CDK_TEST_MINT_URL_2 environment variable:
/// - If set, returns that URL
/// - Otherwise falls back to the default URL from get_mint_url("1")
pub fn get_second_mint_url_from_env() -> String {
match env::var("CDK_TEST_MINT_URL_2") {
Ok(url) => url,
Err(_) => get_mint_url("1"),
}
}