Skip to content

Commit

Permalink
chore: add test for trig never (#1258)
Browse files Browse the repository at this point in the history
Closes #1197

Blocked until FuelLabs/fuel-core#1614 is
included in a release.
  • Loading branch information
MujkicA authored Mar 26, 2024
1 parent 59b4d5b commit e319a44
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions packages/fuels/tests/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use fuels::{
errors::transaction::Reason,
message::Message,
transaction_builders::{BuildableTransaction, ScriptTransactionBuilder},
tx_status::TxStatus,
Bits256,
},
};
Expand Down Expand Up @@ -979,3 +980,35 @@ async fn test_build_with_provider() -> Result<()> {

Ok(())
}

#[tokio::test]
async fn can_produce_blocks_with_trig_never() -> Result<()> {
let config = Config {
block_production: Trigger::Never,
..Config::default()
};
let wallets =
launch_custom_provider_and_get_wallets(WalletsConfig::default(), Some(config), None)
.await?;
let wallet = &wallets[0];
let provider = wallet.try_provider()?;

let inputs = wallet
.get_asset_inputs_for_amount(BASE_ASSET_ID, 100)
.await?;
let outputs =
wallet.get_asset_outputs_for_amount(&Bech32Address::default(), BASE_ASSET_ID, 100);

let mut tb = ScriptTransactionBuilder::prepare_transfer(inputs, outputs, TxPolicies::default());
tb.add_signer(wallet.clone())?;
let tx = tb.build(provider).await?;
let tx_id = tx.id(provider.chain_id());

provider.send_transaction(tx).await?;
provider.produce_blocks(1, None).await?;

let status = provider.tx_status(&tx_id).await?;
assert!(matches!(status, TxStatus::Success { .. }));

Ok(())
}

0 comments on commit e319a44

Please sign in to comment.