Skip to content

Commit d2fd39b

Browse files
committed
fix: Format and dissable unsupported test
Signed-off-by: gsstoykov <[email protected]>
1 parent 6dae7b8 commit d2fd39b

File tree

1 file changed

+27
-35
lines changed

1 file changed

+27
-35
lines changed

tests/e2e/batch_transaction.rs

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::str::FromStr;
2-
use time::{OffsetDateTime, Duration};
32

43
use hedera::{
54
AccountCreateTransaction,
@@ -14,6 +13,10 @@ use hedera::{
1413
TopicCreateTransaction,
1514
TopicMessageSubmitTransaction,
1615
};
16+
use time::{
17+
Duration,
18+
OffsetDateTime,
19+
};
1720

1821
use crate::common::{
1922
setup_nonfree,
@@ -112,10 +115,10 @@ async fn cannot_execute_batch_transaction_without_inner_transactions() -> anyhow
112115

113116
// When / Then
114117
let mut empty_batch = BatchTransaction::new();
115-
118+
116119
// Attempting to execute an empty batch transaction should fail
117120
let result = empty_batch.execute(&client).await;
118-
121+
119122
assert!(result.is_err(), "Expected batch transaction without inner transactions to fail");
120123

121124
Ok(())
@@ -147,10 +150,10 @@ async fn cannot_execute_batch_transaction_with_blacklisted_transaction() -> anyh
147150

148151
// When / Then
149152
let mut batch_transaction = BatchTransaction::new();
150-
153+
151154
// Attempting to add a blacklisted transaction should fail
152155
let result = batch_transaction.add_inner_transaction(freeze_transaction.into());
153-
156+
154157
assert!(result.is_err(), "Expected adding blacklisted transaction to batch to fail");
155158

156159
Ok(())
@@ -173,9 +176,7 @@ async fn cannot_execute_batch_transaction_with_invalid_inner_batch_key() -> anyh
173176

174177
// Create an inner transaction with the WRONG batch key (accountKey instead of operatorKey)
175178
let mut inner_transaction = AccountCreateTransaction::new();
176-
inner_transaction
177-
.set_key_without_alias(account_key.public_key())
178-
.initial_balance(Hbar::new(1));
179+
inner_transaction.set_key_without_alias(account_key.public_key()).initial_balance(Hbar::new(1));
179180

180181
// Batchify with the wrong key - this should cause issues later
181182
inner_transaction.batchify(&client, account_key.public_key().into())?; // Wrong key!
@@ -188,7 +189,7 @@ async fn cannot_execute_batch_transaction_with_invalid_inner_batch_key() -> anyh
188189

189190
// Attempting to execute should fail due to batch key mismatch
190191
let result = batch_transaction.execute(&client).await;
191-
192+
192193
assert!(result.is_err(), "Expected batch transaction with invalid inner batch key to fail");
193194

194195
Ok(())
@@ -212,18 +213,16 @@ async fn cannot_execute_batch_transaction_without_batchifying_inner() -> anyhow:
212213

213214
// Create an inner transaction WITHOUT batchifying it (no freeze, no batch key)
214215
let mut inner_transaction = AccountCreateTransaction::new();
215-
inner_transaction
216-
.set_key_without_alias(account_key.public_key())
217-
.initial_balance(Hbar::new(1));
216+
inner_transaction.set_key_without_alias(account_key.public_key()).initial_balance(Hbar::new(1));
218217

219218
// NOTE: We deliberately do NOT call batchify() here!
220219

221220
// When / Then
222221
let mut batch_transaction = BatchTransaction::new();
223-
222+
224223
// Attempting to add an un-batchified transaction should fail
225224
let result = batch_transaction.add_inner_transaction(inner_transaction.into());
226-
225+
227226
assert!(result.is_err(), "Expected adding non-batchified transaction to batch to fail");
228227

229228
Ok(())
@@ -245,19 +244,16 @@ async fn can_execute_batch_transaction_with_chunked_inner() -> anyhow::Result<()
245244

246245
// When - First create a topic
247246
let mut topic_create = TopicCreateTransaction::new();
248-
topic_create
249-
.admin_key(operator_key.public_key())
250-
.topic_memo("testMemo");
247+
topic_create.admin_key(operator_key.public_key()).topic_memo("testMemo");
251248

252249
let topic_response = topic_create.execute(&client).await?;
253250
let topic_receipt = topic_response.get_receipt(&client).await?;
254-
let topic_id = topic_receipt.topic_id.ok_or_else(|| anyhow::anyhow!("Topic ID not found in receipt"))?;
251+
let topic_id =
252+
topic_receipt.topic_id.ok_or_else(|| anyhow::anyhow!("Topic ID not found in receipt"))?;
255253

256254
// Create a large topic message that will be chunked
257255
let mut inner_transaction = TopicMessageSubmitTransaction::new();
258-
inner_transaction
259-
.topic_id(topic_id)
260-
.message(BIG_CONTENTS.as_bytes().to_vec());
256+
inner_transaction.topic_id(topic_id).message(BIG_CONTENTS.as_bytes().to_vec());
261257

262258
// Batchify the large message transaction
263259
inner_transaction.batchify(&client, operator_key.public_key().into())?;
@@ -273,6 +269,7 @@ async fn can_execute_batch_transaction_with_chunked_inner() -> anyhow::Result<()
273269
}
274270

275271
#[tokio::test]
272+
#[ignore] // Ignored for now as we run the tests with 0.0.2 which does not incur fees
276273
async fn batch_transaction_incurs_fees_even_if_one_inner_failed() -> anyhow::Result<()> {
277274
let Some(TestEnvironment { config: _, client }) = setup_nonfree() else {
278275
return Ok(());
@@ -288,10 +285,7 @@ async fn batch_transaction_incurs_fees_even_if_one_inner_failed() -> anyhow::Res
288285

289286
// Get initial account balance
290287
let initial_balance = {
291-
let account_info = AccountInfoQuery::new()
292-
.account_id(operator_id)
293-
.execute(&client)
294-
.await?;
288+
let account_info = AccountInfoQuery::new().account_id(operator_id).execute(&client).await?;
295289
account_info.balance
296290
};
297291

@@ -314,23 +308,21 @@ async fn batch_transaction_incurs_fees_even_if_one_inner_failed() -> anyhow::Res
314308

315309
// When
316310
let mut batch_transaction = BatchTransaction::new();
317-
batch_transaction.set_inner_transactions(vec![
318-
inner_transaction1.into(),
319-
inner_transaction2.into(),
320-
])?;
311+
batch_transaction
312+
.set_inner_transactions(vec![inner_transaction1.into(), inner_transaction2.into()])?;
321313

322314
let tx_response = batch_transaction.execute(&client).await?;
323-
315+
324316
// Expect the receipt to fail due to the second transaction requiring receiver signature
325317
let receipt_result = tx_response.get_receipt(&client).await;
326-
assert!(receipt_result.is_err(), "Expected batch transaction receipt to fail due to receiver signature requirement");
318+
assert!(
319+
receipt_result.is_err(),
320+
"Expected batch transaction receipt to fail due to receiver signature requirement"
321+
);
327322

328323
// Then - Check that fees were still charged despite the failure
329324
let final_balance = {
330-
let account_info = AccountInfoQuery::new()
331-
.account_id(operator_id)
332-
.execute(&client)
333-
.await?;
325+
let account_info = AccountInfoQuery::new().account_id(operator_id).execute(&client).await?;
334326
account_info.balance
335327
};
336328

0 commit comments

Comments
 (0)