Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions tests/connection_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,25 @@ async fn queue_frames(
highs.into_iter().chain(lows.into_iter()).collect()
}

// Ensure the helper correctly handles edge cases without queued frames.
#[rstest]
#[case(vec![Priority::High, Priority::High, Priority::High, Priority::Low, Priority::Low])]
#[case(vec![Priority::Low, Priority::Low, Priority::High, Priority::High, Priority::High])]
#[tokio::test]
async fn queue_frames_empty_input(queues: (PushQueues<u8>, wireframe::push::PushHandle<u8>)) {
let (_, handle) = queues;
let priorities: &[Priority] = &[];
let result = queue_frames(priorities, &handle, 0).await;
assert!(result.is_empty(), "Expected empty output for empty input");
}
Comment on lines +122 to +130
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider removing this test in favour of the parameterised case.

This standalone test duplicates coverage already provided by the Vec::new() case in the parameterised test below. The parameterised test is more comprehensive as it tests the full actor behaviour rather than just the helper function.

Following the coding guideline to "replace duplicated tests with #[rstest(...)] parameterised cases", this standalone test should be removed.

🤖 Prompt for AI Agents
In tests/connection_actor.rs around lines 122 to 130, the standalone test
queue_frames_empty_input duplicates coverage already provided by the
parameterised test with Vec::new(). Remove this standalone test to avoid
redundancy and follow the guideline of replacing duplicated tests with
parameterised cases that cover the full actor behaviour.


#[rstest]
#[case(Vec::new())]
#[case(vec![Priority::High])]
#[case(vec![Priority::Low])]
#[case(vec![Priority::High, Priority::Low])]
#[case(vec![Priority::High; 3])]
#[case(vec![Priority::Low; 3])]
#[case(vec![Priority::High, Priority::High, Priority::High, Priority::Low, Priority::Low])]
#[case(vec![Priority::Low, Priority::Low, Priority::High, Priority::High, Priority::High])]
#[case(vec![
Priority::High,
Priority::Low,
Expand Down