diff --git a/socketio/src/asynchronous/client/client.rs b/socketio/src/asynchronous/client/client.rs index c6c616a1..7defa49b 100644 --- a/socketio/src/asynchronous/client/client.rs +++ b/socketio/src/asynchronous/client/client.rs @@ -1064,6 +1064,29 @@ mod test { ) ); + let packet: Option = Some(socket_stream.next().await.unwrap()?); + + assert!(packet.is_some()); + + let packet = packet.unwrap(); + assert_eq!( + packet, + Packet::new( + PacketId::Event, + "on_abc_event".to_string(), + Some( + serde_json::json!({ + "abc": 0, + "some_other": "value", + }).to_string() + ), + None, + 0, + None, + ) + ); + + let cb = |message: Payload, _| { async { println!("Yehaa! My ack got acked?"); diff --git a/socketio/src/client/raw_client.rs b/socketio/src/client/raw_client.rs index c308c4ae..8df80ac0 100644 --- a/socketio/src/client/raw_client.rs +++ b/socketio/src/client/raw_client.rs @@ -753,6 +753,29 @@ mod test { ) ); + let packet: Option = iter.next(); + + assert!(packet.is_some()); + + let packet = packet.unwrap(); + assert_eq!( + packet, + Packet::new( + PacketId::Event, + "on_abc_event".to_string(), + Some( + serde_json::json!({ + "abc": 0, + "some_other": "value", + }).to_string() + ), + None, + 0, + None, + ) + ); + + assert!(socket .emit_with_ack( "test",