Skip to content

Commit

Permalink
Add tests success blob,upgrade,upload
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienFT committed Dec 2, 2024
1 parent 58616aa commit 3ce5952
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
16 changes: 16 additions & 0 deletions fuel-tx/src/tests/valid_cases/transaction/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ fn check__fails_if_maturity_not_met() {
assert_eq!(Err(ValidityError::TransactionMaturity), result);
}

#[test]
fn check__success_if_expiration_met() {
// Given
let block_height: BlockHeight = 1000.into();
let success_block_height = block_height.succ().unwrap();
let tx = valid_blob_transaction()
.expiration(success_block_height)
.finalize_as_transaction();

// When
let result = tx.check(block_height, &test_params());

// Then
assert_eq!(Ok(()), result);
}

#[test]
fn check__fails_if_expiration_not_met() {
// Given
Expand Down
16 changes: 16 additions & 0 deletions fuel-tx/src/tests/valid_cases/transaction/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ fn maturity() {
assert_eq!(Err(ValidityError::TransactionMaturity), result);
}

#[test]
fn upgrade__check__success_if_expiration_met() {
// Given
let block_height: BlockHeight = 1000.into();
let success_block_height = block_height.succ().unwrap();
let tx = valid_upgrade_transaction()
.expiration(success_block_height)
.finalize_as_transaction();

// When
let result = tx.check(block_height, &test_params());

// Then
assert_eq!(Ok(()), result);
}

#[test]
fn upgrade__check__valid_expiration_policy() {
let block_height: BlockHeight = 1000.into();
Expand Down
16 changes: 16 additions & 0 deletions fuel-tx/src/tests/valid_cases/transaction/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,22 @@ fn maturity() {
assert_eq!(Err(ValidityError::TransactionMaturity), result);
}

#[test]
fn upload__check__success_if_expiration_met() {
// Given
let block_height: BlockHeight = 1000.into();
let success_block_height = block_height.succ().unwrap();
let tx = valid_upload_transaction()
.expiration(success_block_height)
.finalize_as_transaction();

// When
let result = tx.check(block_height, &test_params());

// Then
assert_eq!(Ok(()), result);
}

#[test]
fn upload__check__valid_expiration_policy() {
let block_height: BlockHeight = 1000.into();
Expand Down

0 comments on commit 3ce5952

Please sign in to comment.