use std::time::Duration;
use alloy::eips::BlockId;
use alloy::providers::Provider;
use super::ScriptedRpc;
#[tokio::test]
async fn a_scripted_head_decodes_at_its_timestamp() {
let provider = ScriptedRpc::parked_receipt().at_head(7).provider();
let head = provider
.get_block(BlockId::latest())
.await
.expect("the scripted head decodes")
.expect("the scripted head is present");
assert_eq!(head.header.timestamp, 7);
}
#[tokio::test(start_paused = true)]
async fn a_block_read_with_no_head_set_parks() {
let provider = ScriptedRpc::parked_receipt().provider();
let read = tokio::time::timeout(
Duration::from_secs(60),
provider.get_block(BlockId::latest()),
)
.await;
assert!(read.is_err(), "the block read must still be pending");
}