Skip to content

Commit

Permalink
Implment test for multpayload
Browse files Browse the repository at this point in the history
  • Loading branch information
shenjackyuanjie committed Apr 10, 2024
1 parent 1ba8111 commit f4f4094
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
23 changes: 23 additions & 0 deletions socketio/src/asynchronous/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,29 @@ mod test {
)
);

let packet: Option<Packet> = 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?");
Expand Down
23 changes: 23 additions & 0 deletions socketio/src/client/raw_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,29 @@ mod test {
)
);

let packet: Option<Packet> = 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",
Expand Down

0 comments on commit f4f4094

Please sign in to comment.