Skip to content

Commit

Permalink
fix: itests
Browse files Browse the repository at this point in the history
  • Loading branch information
thesimplekid committed Feb 8, 2025
1 parent e1ed23c commit 2049053
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
34 changes: 23 additions & 11 deletions crates/cdk-integration-tests/tests/fake_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ async fn test_fake_mint_inflated() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let mint_quote = wallet.mint_quote(100.into(), None).await?;
Expand Down Expand Up @@ -521,7 +522,7 @@ async fn test_fake_mint_inflated() -> Result<()> {
}
let http_client = HttpClient::new(MINT_URL.parse()?);

let response = http_client.post_mint(mint_request.clone()).await;
let response = http_client.post_mint(mint_request.clone(), None).await;

match response {
Err(err) => match err {
Expand All @@ -546,6 +547,7 @@ async fn test_fake_mint_multiple_units() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let mint_quote = wallet.mint_quote(100.into(), None).await?;
Expand All @@ -562,6 +564,7 @@ async fn test_fake_mint_multiple_units() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let active_keyset_id = wallet_usd.get_active_mint_keyset().await?.id;
Expand Down Expand Up @@ -591,7 +594,7 @@ async fn test_fake_mint_multiple_units() -> Result<()> {
}
let http_client = HttpClient::new(MINT_URL.parse()?);

let response = http_client.post_mint(mint_request.clone()).await;
let response = http_client.post_mint(mint_request.clone(), None).await;

match response {
Err(err) => match err {
Expand All @@ -616,6 +619,7 @@ async fn test_fake_mint_multiple_unit_swap() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let mint_quote = wallet.mint_quote(100.into(), None).await?;
Expand All @@ -630,6 +634,7 @@ async fn test_fake_mint_multiple_unit_swap() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let mint_quote = wallet_usd.mint_quote(100.into(), None).await?;
Expand Down Expand Up @@ -657,7 +662,7 @@ async fn test_fake_mint_multiple_unit_swap() -> Result<()> {
};

let http_client = HttpClient::new(MINT_URL.parse()?);
let response = http_client.post_swap(swap_request.clone()).await;
let response = http_client.post_swap(swap_request.clone(), None).await;

match response {
Err(err) => match err {
Expand Down Expand Up @@ -694,7 +699,7 @@ async fn test_fake_mint_multiple_unit_swap() -> Result<()> {
};

let http_client = HttpClient::new(MINT_URL.parse()?);
let response = http_client.post_swap(swap_request.clone()).await;
let response = http_client.post_swap(swap_request.clone(), None).await;

match response {
Err(err) => match err {
Expand All @@ -720,6 +725,7 @@ async fn test_fake_mint_multiple_unit_melt() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let mint_quote = wallet.mint_quote(100.into(), None).await.unwrap();
Expand All @@ -739,6 +745,7 @@ async fn test_fake_mint_multiple_unit_melt() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let mint_quote = wallet_usd.mint_quote(100.into(), None).await.unwrap();
Expand Down Expand Up @@ -768,7 +775,7 @@ async fn test_fake_mint_multiple_unit_melt() -> Result<()> {
};

let http_client = HttpClient::new(MINT_URL.parse()?);
let response = http_client.post_melt(melt_request.clone()).await;
let response = http_client.post_melt(melt_request.clone(), None).await;

match response {
Err(err) => match err {
Expand Down Expand Up @@ -812,7 +819,7 @@ async fn test_fake_mint_multiple_unit_melt() -> Result<()> {
};

let http_client = HttpClient::new(MINT_URL.parse()?);
let response = http_client.post_melt(melt_request.clone()).await;
let response = http_client.post_melt(melt_request.clone(), None).await;

match response {
Err(err) => match err {
Expand All @@ -839,6 +846,7 @@ async fn test_fake_mint_input_output_mismatch() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let mint_quote = wallet.mint_quote(100.into(), None).await?;
Expand All @@ -853,6 +861,7 @@ async fn test_fake_mint_input_output_mismatch() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let usd_active_keyset_id = wallet_usd.get_active_mint_keyset().await?.id;
Expand All @@ -871,7 +880,7 @@ async fn test_fake_mint_input_output_mismatch() -> Result<()> {
};

let http_client = HttpClient::new(MINT_URL.parse()?);
let response = http_client.post_swap(swap_request.clone()).await;
let response = http_client.post_swap(swap_request.clone(), None).await;

match response {
Err(err) => match err {
Expand All @@ -895,6 +904,7 @@ async fn test_fake_mint_swap_inflated() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let mint_quote = wallet.mint_quote(100.into(), None).await?;
Expand All @@ -911,7 +921,7 @@ async fn test_fake_mint_swap_inflated() -> Result<()> {
};

let http_client = HttpClient::new(MINT_URL.parse()?);
let response = http_client.post_swap(swap_request.clone()).await;
let response = http_client.post_swap(swap_request.clone(), None).await;

match response {
Err(err) => match err {
Expand All @@ -937,6 +947,7 @@ async fn test_fake_mint_duplicate_proofs_swap() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let mint_quote = wallet.mint_quote(100.into(), None).await?;
Expand All @@ -958,7 +969,7 @@ async fn test_fake_mint_duplicate_proofs_swap() -> Result<()> {
};

let http_client = HttpClient::new(MINT_URL.parse()?);
let response = http_client.post_swap(swap_request.clone()).await;
let response = http_client.post_swap(swap_request.clone(), None).await;

match response {
Err(err) => match err {
Expand All @@ -982,7 +993,7 @@ async fn test_fake_mint_duplicate_proofs_swap() -> Result<()> {
let swap_request = SwapRequest { inputs, outputs };

let http_client = HttpClient::new(MINT_URL.parse()?);
let response = http_client.post_swap(swap_request.clone()).await;
let response = http_client.post_swap(swap_request.clone(), None).await;

match response {
Err(err) => match err {
Expand Down Expand Up @@ -1011,6 +1022,7 @@ async fn test_fake_mint_duplicate_proofs_melt() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let mint_quote = wallet.mint_quote(100.into(), None).await?;
Expand All @@ -1032,7 +1044,7 @@ async fn test_fake_mint_duplicate_proofs_melt() -> Result<()> {
};

let http_client = HttpClient::new(MINT_URL.parse()?);
let response = http_client.post_melt(melt_request.clone()).await;
let response = http_client.post_melt(melt_request.clone(), None).await;

match response {
Err(err) => match err {
Expand Down
2 changes: 2 additions & 0 deletions crates/cdk-integration-tests/tests/regtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,15 @@ async fn test_multimint_melt() -> Result<()> {
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;
let wallet2 = Wallet::new(
&get_mint_url("1"),
CurrencyUnit::Sat,
Arc::new(WalletMemoryDatabase::default()),
&Mnemonic::generate(12)?.to_seed_normalized(""),
None,
None,
)?;

let mint_amount = Amount::from(100);
Expand Down

0 comments on commit 2049053

Please sign in to comment.