Skip to content

Commit

Permalink
feat: frame queue tests
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Oct 3, 2024
1 parent 54c1356 commit 062ab21
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/derive/src/stages/frame_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,21 @@ pub(crate) mod tests {
assert_eq!(err, PipelineError::Eof.temp());
}

#[tokio::test]
async fn test_holocene_single_invalid_frame() {
let frames = vec![Frame { id: [0xEE; 16], number: 1, data: vec![0xDD; 50], is_last: true }];
let encoded = encode_frames(frames.clone());
let config = RollupConfig { holocene_time: Some(0), ..Default::default() };
let mut mock = MockFrameQueueProvider::new(vec![Ok(encoded)]);
mock.set_origin(BlockInfo::default());
let mut frame_queue = FrameQueue::new(mock, Arc::new(config));
assert!(frame_queue.is_holocene_active(BlockInfo::default()));
let decoded = frame_queue.next_frame().await.unwrap();
assert_eq!(decoded, frames[0]);
let err = frame_queue.next_frame().await.unwrap_err();
assert_eq!(err, PipelineError::Eof.temp());
}

#[tokio::test]
async fn test_holocene_unordered_frames() {
let frames = vec![
Expand Down

0 comments on commit 062ab21

Please sign in to comment.