File tree Expand file tree Collapse file tree
crates/hotfix/tests/session_test_cases Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ use hotfix_message::fix44::MSG_TYPE;
99use hotfix_message:: message:: Message ;
1010use 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]
1315async 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]
2832async 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" ,
You can’t perform that action at this time.
0 commit comments