Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo committed Jan 8, 2025
1 parent 3d020b8 commit d97732e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
38 changes: 25 additions & 13 deletions crates/static-file/static-file/src/static_file_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,7 @@ where
)
}),
block_meta: finalized_block_numbers.block_meta.and_then(|finalized_block_number| {
self.get_static_file_target(
highest_static_files.block_meta,
finalized_block_number,
)
self.get_static_file_target(highest_static_files.block_meta, finalized_block_number)
}),
};

Expand Down Expand Up @@ -329,7 +326,7 @@ mod tests {
headers: Some(1),
receipts: Some(1),
transactions: Some(1),
block_meta: Some(1),
block_meta: None,
})
.expect("get static file targets");
assert_eq!(
Expand All @@ -338,21 +335,26 @@ mod tests {
headers: Some(0..=1),
receipts: Some(0..=1),
transactions: Some(0..=1),
block_meta: Some(0..=1)
block_meta: None
}
);
assert_matches!(static_file_producer.run(targets), Ok(_));
assert_eq!(
provider_factory.static_file_provider().get_highest_static_files(),
HighestStaticFiles { headers: Some(1), receipts: Some(1), transactions: Some(1), block_meta: Some(1) }
HighestStaticFiles {
headers: Some(1),
receipts: Some(1),
transactions: Some(1),
block_meta: None
}
);

let targets = static_file_producer
.get_static_file_targets(HighestStaticFiles {
headers: Some(3),
receipts: Some(3),
transactions: Some(3),
block_meta: Some(3),
block_meta: None,
})
.expect("get static file targets");
assert_eq!(
Expand All @@ -361,21 +363,26 @@ mod tests {
headers: Some(2..=3),
receipts: Some(2..=3),
transactions: Some(2..=3),
block_meta: Some(2..=3)
block_meta: None
}
);
assert_matches!(static_file_producer.run(targets), Ok(_));
assert_eq!(
provider_factory.static_file_provider().get_highest_static_files(),
HighestStaticFiles { headers: Some(3), receipts: Some(3), transactions: Some(3), block_meta: Some(3) }
HighestStaticFiles {
headers: Some(3),
receipts: Some(3),
transactions: Some(3),
block_meta: None
}
);

let targets = static_file_producer
.get_static_file_targets(HighestStaticFiles {
headers: Some(4),
receipts: Some(4),
transactions: Some(4),
block_meta: Some(4),
block_meta: None,
})
.expect("get static file targets");
assert_eq!(
Expand All @@ -384,7 +391,7 @@ mod tests {
headers: Some(4..=4),
receipts: Some(4..=4),
transactions: Some(4..=4),
block_meta: Some(4..=4)
block_meta: None
}
);
assert_matches!(
Expand All @@ -393,7 +400,12 @@ mod tests {
);
assert_eq!(
provider_factory.static_file_provider().get_highest_static_files(),
HighestStaticFiles { headers: Some(3), receipts: Some(3), transactions: Some(3), block_meta: Some(3) }
HighestStaticFiles {
headers: Some(3),
receipts: Some(3),
transactions: Some(3),
block_meta: None
}
);
}

Expand Down
5 changes: 4 additions & 1 deletion crates/static-file/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ pub struct StaticFileTargets {
impl StaticFileTargets {
/// Returns `true` if any of the targets are [Some].
pub const fn any(&self) -> bool {
self.headers.is_some() || self.receipts.is_some() || self.transactions.is_some() || self.block_meta.is_some()
self.headers.is_some() ||
self.receipts.is_some() ||
self.transactions.is_some() ||
self.block_meta.is_some()
}

/// Returns `true` if all targets are either [`None`] or has beginning of the range equal to the
Expand Down

0 comments on commit d97732e

Please sign in to comment.