Skip to content

Commit

Permalink
fix: retain test
Browse files Browse the repository at this point in the history
  • Loading branch information
rymnc committed Sep 24, 2024
1 parent 2953019 commit 62343d7
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ use fuel_core_storage::{
};
use fuel_gas_price_algorithm::v0::AlgorithmUpdaterV0;

fn arb_metadata() -> UpdaterMetadata {
let height = 111231u32.into();
arb_metadata_with_l2_height(height)
}

fn arb_metadata_with_l2_height(l2_height: BlockHeight) -> UpdaterMetadata {
let inner = AlgorithmUpdaterV0 {
new_exec_price: 100,
Expand All @@ -30,6 +35,25 @@ fn database() -> StorageTransaction<InMemoryStorage<GasPriceColumn>> {
InMemoryStorage::default().into_transaction()
}

#[tokio::test]
async fn get_metadata__can_get_most_recent_version() {
// given
let mut database = database();
let block_height: BlockHeight = 1u32.into();
let metadata = arb_metadata();
database
.storage_as_mut::<GasPriceMetadata>()
.insert(&block_height, &metadata)
.unwrap();

// when
let actual = database.get_metadata(&block_height).unwrap();

// then
let expected = Some(metadata);
assert_eq!(expected, actual);
}

#[tokio::test]
async fn get_metadata__returns_none_if_does_not_exist() {
// given
Expand Down

0 comments on commit 62343d7

Please sign in to comment.