Skip to content

Commit

Permalink
add a test for 2b2t queue chat message
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-1 committed Dec 23, 2024
1 parent 63fef9d commit 2c37ade
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions azalea-protocol/src/packets/game/c_system_chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,18 @@ mod tests {
"Displaying particle minecraft:dust".to_string()
);
}

#[test]
fn test_2b2t_queue_message() {
#[rustfmt::skip]
let bytes = [
10, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 8, 0, 4, 116, 101, 120, 116, 0, 95, 80, 111, 115, 105, 116, 105, 111, 110, 32, 105, 110, 32, 113, 117, 101, 117, 101, 58, 32, 51, 50, 56, 10, 89, 111, 117, 32, 99, 97, 110, 32, 112, 117, 114, 99, 104, 97, 115, 101, 32, 112, 114, 105, 111, 114, 105, 116, 121, 32, 113, 117, 101, 117, 101, 32, 115, 116, 97, 116, 117, 115, 32, 116, 111, 32, 106, 111, 105, 110, 32, 116, 104, 101, 32, 115, 101, 114, 118, 101, 114, 32, 102, 97, 115, 116, 101, 114, 44, 32, 118, 105, 115, 105, 116, 32, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 111, 108, 100, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 10, 0, 10, 99, 108, 105, 99, 107, 69, 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 8, 111, 112, 101, 110, 95, 117, 114, 108, 8, 0, 5, 118, 97, 108, 117, 101, 0, 22, 104, 116, 116, 112, 115, 58, 47, 47, 115, 104, 111, 112, 46, 50, 98, 50, 116, 46, 111, 114, 103, 47, 0, 1, 0, 4, 98, 111, 108, 100, 1, 8, 0, 4, 116, 101, 120, 116, 0, 13, 115, 104, 111, 112, 46, 50, 98, 50, 116, 46, 111, 114, 103, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 20, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0
];
let packet = ClientboundSystemChat::azalea_read(&mut Cursor::new(&bytes)).unwrap();

assert_eq!(
packet.content.to_string().trim(),
"Position in queue: 328\nYou can purchase priority queue status to join the server faster, visit shop.2b2t.org".to_string()
);
}
}

0 comments on commit 2c37ade

Please sign in to comment.