Skip to content

Commit 6fc4b9b

Browse files
committed
Add doc comments for invalid message tests
1 parent e9f68ef commit 6fc4b9b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

crates/hotfix/tests/session_test_cases/invalid_message_tests.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use hotfix_message::fix44::MSG_TYPE;
99
use hotfix_message::message::Message;
1010
use hotfix_message::{HardCodedFixFieldDefinition, Part, fix44};
1111

12+
/// Tests that when a counterparty sends a message containing an invalid/unrecognised field,
13+
/// the session rejects the message by sending a Reject (MsgType=3) message back.
1214
#[tokio::test]
1315
async fn test_message_with_invalid_field_gets_rejected() {
1416
let (session, mut mock_counterparty) = given_an_active_session().await;
@@ -24,11 +26,13 @@ async fn test_message_with_invalid_field_gets_rejected() {
2426
then(&mut mock_counterparty).gets_disconnected().await;
2527
}
2628

29+
/// Tests that when a counterparty sends a garbled message with an invalid body length,
30+
/// the session silently ignores it and detects a sequence gap when the next valid message arrives.
2731
#[tokio::test]
2832
async fn test_garbled_message_with_invalid_target_comp_id_gets_ignored() {
2933
let (session, mut mock_counterparty) = given_an_active_session().await;
3034

31-
// counterparty sends a message with an invalid target comp id
35+
// counterparty sends a message with invalid body length, which constitutes a garbled message
3236
let garbled_message = build_execution_report_with_incorrect_body_length(
3337
"dummy-acceptor",
3438
"dummy-initiator",

0 commit comments

Comments
 (0)